mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
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:
@ -17,6 +17,22 @@ RSpec.describe DiscourseHub do
|
||||
end
|
||||
end
|
||||
|
||||
describe ".discover_enrollment" do
|
||||
it "should trigger a POST request to hub" do
|
||||
stub_request(
|
||||
:post,
|
||||
(ENV["HUB_BASE_URL"] || "http://local.hub:3000/api") + "/discover/enroll",
|
||||
).with(body: JSON[DiscourseHub.discover_enrollment_payload]).to_return(
|
||||
status: 200,
|
||||
body: "",
|
||||
headers: {
|
||||
},
|
||||
)
|
||||
|
||||
DiscourseHub.discover_enrollment
|
||||
end
|
||||
end
|
||||
|
||||
describe ".version_check_payload" do
|
||||
describe "when Discourse Hub has not fetched stats since past 7 days" do
|
||||
it "should include stats" do
|
||||
|
Reference in New Issue
Block a user