From e90ee46cd1c5f8db2fdb9fe259ed643b289add89 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 14 Sep 2015 16:20:56 -0400 Subject: [PATCH] closes #3603 --- src/user/settings.js | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/user/settings.js b/src/user/settings.js index 03922ade45..17e524bcb7 100644 --- a/src/user/settings.js +++ b/src/user/settings.js @@ -99,27 +99,32 @@ module.exports = function(User) { plugins.fireHook('action:user.saveSettings', {uid: uid, settings: data}); + var settings = { + showemail: data.showemail, + showfullname: data.showfullname, + openOutgoingLinksInNewTab: data.openOutgoingLinksInNewTab, + dailyDigestFreq: data.dailyDigestFreq || 'off', + usePagination: data.usePagination, + topicsPerPage: Math.min(data.topicsPerPage, parseInt(meta.config.topicsPerPage, 10) || 20), + postsPerPage: Math.min(data.postsPerPage, parseInt(meta.config.postsPerPage, 10) || 20), + notificationSounds: data.notificationSounds, + userLang: data.userLang || meta.config.defaultLang, + followTopicsOnCreate: data.followTopicsOnCreate, + followTopicsOnReply: data.followTopicsOnReply, + sendChatNotifications: data.sendChatNotifications, + sendPostNotifications: data.sendPostNotifications, + restrictChat: data.restrictChat, + topicSearchEnabled: data.topicSearchEnabled, + groupTitle: data.groupTitle + }; + + if (data.bootswatchSkin) { + settings.bootswatchSkin = data.bootswatchSkin; + } + async.waterfall([ function(next) { - db.setObject('user:' + uid + ':settings', { - showemail: data.showemail, - showfullname: data.showfullname, - openOutgoingLinksInNewTab: data.openOutgoingLinksInNewTab, - dailyDigestFreq: data.dailyDigestFreq || 'off', - usePagination: data.usePagination, - topicsPerPage: Math.min(data.topicsPerPage, parseInt(meta.config.topicsPerPage, 10) || 20), - postsPerPage: Math.min(data.postsPerPage, parseInt(meta.config.postsPerPage, 10) || 20), - notificationSounds: data.notificationSounds, - userLang: data.userLang || meta.config.defaultLang, - followTopicsOnCreate: data.followTopicsOnCreate, - followTopicsOnReply: data.followTopicsOnReply, - sendChatNotifications: data.sendChatNotifications, - sendPostNotifications: data.sendPostNotifications, - restrictChat: data.restrictChat, - topicSearchEnabled: data.topicSearchEnabled, - bootswatchSkin: data.bootswatchSkin, - groupTitle: data.groupTitle - }, next); + db.setObject('user:' + uid + ':settings', settings, next); }, function(next) { updateDigestSetting(uid, data.dailyDigestFreq, next);