Merge pull request #4007 from tgxworld/fix_siitesetting_not_published_to_clients

FIX: Client settings were not being published.
This commit is contained in:
Régis Hanol 2016-02-11 11:51:10 +01:00
commit 75a78e0518
2 changed files with 13 additions and 2 deletions

View file

@ -151,7 +151,7 @@ module SiteSettingExtension
# just like a setting, except that it is available in javascript via DiscourseSession # just like a setting, except that it is available in javascript via DiscourseSession
def client_setting(name, default = nil, opts = {}) def client_setting(name, default = nil, opts = {})
setting(name, default, opts) setting(name, default, opts)
client_settings << name client_settings << name.to_sym
end end
def settings_hash def settings_hash

View file

@ -140,6 +140,17 @@ describe SiteSettingExtension do
settings.set("test_setting", 12) settings.set("test_setting", 12)
expect(settings.test_setting).to eq(12) expect(settings.test_setting).to eq(12)
end end
it "should publish changes to clients" do
settings.setting("test_setting", 100)
settings.client_setting("test_setting")
messages = MessageBus.track_publish do
settings.test_setting = 88
end
expect(messages.map(&:channel).include?('/client_settings')).to eq(true)
end
end end
end end