Commit 6391cc08 authored by JC Brand's avatar JC Brand

Rename applyUserSettings to applySiteSettings

parent 030c26a8
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
return describe("Converse.js Utilities", function() { return describe("Converse.js Utilities", function() {
it("applyUserSettings: recursively applies user settings", function () { it("applySiteSettings: recursively applies user settings", function () {
var context = {}; var context = {};
var settings = { var settings = {
show_toolbar: true, show_toolbar: true,
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
'invalid': false 'invalid': false
} }
}; };
utils.applyUserSettings(context, settings, user_settings); utils.applySiteSettings(context, settings, user_settings);
expect(context.something_else).toBeUndefined(); expect(context.something_else).toBeUndefined();
expect(context.show_toolbar).toBeFalsy(); expect(context.show_toolbar).toBeFalsy();
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
'toggle_occupants': true 'toggle_occupants': true
} }
}; };
utils.applyUserSettings(context, settings, user_settings); utils.applySiteSettings(context, settings, user_settings);
expect(_.keys(context.visible_toolbar_buttons)).toEqual(_.keys(settings.visible_toolbar_buttons)); expect(_.keys(context.visible_toolbar_buttons)).toEqual(_.keys(settings.visible_toolbar_buttons));
expect(context.visible_toolbar_buttons.toggle_occupants).toBeTruthy(); expect(context.visible_toolbar_buttons.toggle_occupants).toBeTruthy();
}); });
......
...@@ -533,7 +533,7 @@ const api = _converse.api = { ...@@ -533,7 +533,7 @@ const api = _converse.api = {
update (settings) { update (settings) {
u.merge(DEFAULT_SETTINGS, settings); u.merge(DEFAULT_SETTINGS, settings);
u.merge(_converse, settings); u.merge(_converse, settings);
u.applyUserSettings(_converse, settings, _converse.user_settings); u.applySiteSettings(_converse, settings, _converse.site_settings);
}, },
/** /**
...@@ -1594,7 +1594,7 @@ function initSettings (settings) { ...@@ -1594,7 +1594,7 @@ function initSettings (settings) {
// Allow only whitelisted configuration attributes to be overwritten // Allow only whitelisted configuration attributes to be overwritten
assignIn(_converse.settings, pick(settings, Object.keys(DEFAULT_SETTINGS))); assignIn(_converse.settings, pick(settings, Object.keys(DEFAULT_SETTINGS)));
assignIn(_converse, _converse.settings); assignIn(_converse, _converse.settings);
_converse.user_settings = settings; // XXX: See whether _converse can be removed _converse.site_settings = settings;
} }
......
...@@ -235,7 +235,7 @@ u.merge = function merge (first, second) { ...@@ -235,7 +235,7 @@ u.merge = function merge (first, second) {
} }
}; };
u.applyUserSettings = function applyUserSettings (context, settings, user_settings) { u.applySiteSettings = function applySiteSettings (context, settings, user_settings) {
/* Configuration settings might be nested objects. We only want to /* Configuration settings might be nested objects. We only want to
* add settings which are whitelisted. * add settings which are whitelisted.
*/ */
...@@ -244,7 +244,7 @@ u.applyUserSettings = function applyUserSettings (context, settings, user_settin ...@@ -244,7 +244,7 @@ u.applyUserSettings = function applyUserSettings (context, settings, user_settin
continue; continue;
} }
if (isObject(settings[k]) && !Array.isArray(settings[k])) { if (isObject(settings[k]) && !Array.isArray(settings[k])) {
applyUserSettings(context[k], settings[k], user_settings[k]); applySiteSettings(context[k], settings[k], user_settings[k]);
} else { } else {
context[k] = user_settings[k]; context[k] = user_settings[k];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment