Merge pull request #3590 from thelounge/xpaw/fix-sync

Fix synchronizing settings on page load
This commit is contained in:
Pavel Djundik 2019-12-15 19:10:15 +02:00 committed by GitHub
commit 5b55ac7d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 4 deletions

View File

@ -10,8 +10,9 @@ export const config = normalizeConfig({
syncSettings: {
default: true,
sync: "never",
apply(store, value) {
if (value) {
apply(store, value, auto = false) {
// If applied by settings/applyAll, do not emit to server
if (value && !auto) {
socket.emit("setting:get");
}
},

View File

@ -10,7 +10,6 @@ socket.once("configuration", function(data) {
// 'theme' setting depends on serverConfiguration.themes so
// settings cannot be applied before this point
store.dispatch("settings/applyAll");
socket.emit("setting:get");
if (data.fileUpload) {
upload.initialize();

View File

@ -22,6 +22,8 @@ socket.on("init", function(data) {
store.commit("appLoaded");
socket.emit("setting:get");
if (window.g_TheLoungeRemoveLoading) {
window.g_TheLoungeRemoveLoading();
}

View File

@ -27,7 +27,7 @@ export function createSettingsStore(store) {
},
applyAll({state}) {
for (const settingName in config) {
config[settingName].apply(store, state[settingName]);
config[settingName].apply(store, state[settingName], true);
}
},
update({state, commit}, {name, value, sync = false}) {