DEV: include more data in Discourse Discover enrollment payload. (#25846)

Adding forum's URL, title, and locale to the payload of enrollment can be helpful while managing it in the Discourse Discover.
This commit is contained in:
Vinoth Kannan 2024-02-25 10:42:50 +05:30 committed by GitHub
parent 23bce774d7
commit 1bd9ca11e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

@ -15,7 +15,12 @@ module DiscourseHub
end
def self.discover_enrollment_payload
{ include_in_discourse_discover: SiteSetting.include_in_discourse_discover? }
{
include_in_discourse_discover: SiteSetting.include_in_discourse_discover?,
forum_url: Discourse.base_url,
forum_title: SiteSetting.title,
locale: I18n.locale,
}
end
def self.discover_enrollment

View File

@ -33,6 +33,15 @@ RSpec.describe DiscourseHub do
end
end
describe ".discover_enrollment_payload" do
it "should return the correct payload" do
payload = DiscourseHub.discover_enrollment_payload
expect(payload[:forum_url]).to eq(Discourse.base_url)
expect(payload[:forum_title]).to eq(SiteSetting.title)
expect(payload[:locale]).to eq(I18n.locale)
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