mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Merge pull request #4007 from tgxworld/fix_siitesetting_not_published_to_clients
FIX: Client settings were not being published.
This commit is contained in:
commit
75a78e0518
2 changed files with 13 additions and 2 deletions
|
@ -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
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe SiteSettingExtension do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
let :provider_local do
|
let :provider_local do
|
||||||
SiteSettings::LocalProcessProvider.new
|
SiteSettings::LocalProcessProvider.new
|
||||||
end
|
end
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue