FEATURE: call hub API to update Discourse discover enrollment. (#25634)

Now forums can enroll their sites to be showcased in the Discourse [Discover](https://discourse.org/discover) directory. Once they enable the site setting `include_in_discourse_discover` to enroll their forum the `CallDiscourseHub` job will ping the `api.discourse.org/api/discover/enroll` endpoint. Then the Discourse Hub will fetch the basic details from the forum and add it to the review queue. If the site is approved then the forum details will be displayed in the `/discover` page.
This commit is contained in:
Vinoth Kannan
2024-02-23 11:42:28 +05:30
committed by GitHub
parent 207cb2052f
commit b3238bfc34
16 changed files with 102 additions and 9 deletions

View File

@ -48,6 +48,17 @@ RSpec.describe AboutController do
expect(response.parsed_body["about"].keys).to include("stats")
end
it "adds Discourse Discover status if enabled" do
get "/about.json"
expect(response.parsed_body["about"].keys).not_to include("discourse_discover_enrolled")
SiteSetting.include_in_discourse_discover = true
get "/about.json"
expect(response.parsed_body["about"]["discourse_discover_enrolled"]).to eq(true)
end
it "does not serialize stats when 'Guardian#can_see_about_stats?' is false" do
Guardian.any_instance.stubs(:can_see_about_stats?).returns(false)
get "/about.json"