FIX: Calculate experiment_enabled on server for "What's new?" (#30599)

Experimental "What's new?" feature feed items previously calculated
a boolean for experimentEnabled on the client based on the siteSettings
service, and this would control the initial state of the experiment
toggle.

However this requires the person who creates the site setting for the
experiment to remember to set it to `client: true`. This commit removes
that manual step by calculating whether the experiment is enabled
server-side, where we have access to all the site settings.
This commit is contained in:
Martin Brennan
2025-01-07 11:27:24 +10:00
committed by GitHub
parent f015ea897e
commit 725e146dca
5 changed files with 22 additions and 16 deletions

View File

@ -277,8 +277,11 @@ RSpec.describe DiscourseUpdates do
expect(result.length).to eq(3)
expect(result[0]["experiment_setting"]).to eq("enable_mobile_theme")
expect(result[0]["experiment_enabled"]).to eq(true)
expect(result[1]["experiment_setting"]).to be_nil
expect(result[1]["experiment_enabled"]).to eq(false)
expect(result[2]["experiment_setting"]).to be_nil
expect(result[2]["experiment_enabled"]).to eq(false)
end
it "correctly shows features when related plugins are installed" do