|
|
|
@ -6,6 +6,7 @@ var async = require('async');
|
|
|
|
|
var meta = require('../meta');
|
|
|
|
|
var db = require('../database');
|
|
|
|
|
var plugins = require('../plugins');
|
|
|
|
|
var notifications = require('../notifications');
|
|
|
|
|
|
|
|
|
|
module.exports = function (User) {
|
|
|
|
|
User.getSettings = function (uid, callback) {
|
|
|
|
@ -81,12 +82,14 @@ module.exports = function (User) {
|
|
|
|
|
settings.delayImageLoading = parseInt(getSetting(settings, 'delayImageLoading', 1), 10) === 1;
|
|
|
|
|
settings.bootswatchSkin = settings.bootswatchSkin || meta.config.bootswatchSkin || 'default';
|
|
|
|
|
settings.scrollToMyPost = parseInt(getSetting(settings, 'scrollToMyPost', 1), 10) === 1;
|
|
|
|
|
settings.notificationType_upvote = getSetting(settings, 'notificationType_upvote', 'notification');
|
|
|
|
|
settings['notificationType_new-topic'] = getSetting(settings, 'notificationType_new-topic', 'notification');
|
|
|
|
|
settings['notificationType_new-reply'] = getSetting(settings, 'notificationType_new-reply', 'notification');
|
|
|
|
|
settings.notificationType_follow = getSetting(settings, 'notificationType_follow', 'notification');
|
|
|
|
|
settings['notificationType_new-chat'] = getSetting(settings, 'notificationType_new-chat', 'notification');
|
|
|
|
|
settings['notificationType_group-invite'] = getSetting(settings, 'notificationType_group-invite', 'notification');
|
|
|
|
|
|
|
|
|
|
notifications.getAllNotificationTypes(next);
|
|
|
|
|
},
|
|
|
|
|
function (notificationTypes, next) {
|
|
|
|
|
notificationTypes.forEach(function (notificationType) {
|
|
|
|
|
settings[notificationType] = getSetting(settings, notificationType, 'notification');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
next(null, settings);
|
|
|
|
|
},
|
|
|
|
|
], callback);
|
|
|
|
@ -139,26 +142,20 @@ module.exports = function (User) {
|
|
|
|
|
upvoteNotifFreq: data.upvoteNotifFreq,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var notificationTypes = [
|
|
|
|
|
'notificationType_upvote', 'notificationType_new-topic', 'notificationType_new-reply',
|
|
|
|
|
'notificationType_follow', 'notificationType_new-chat', 'notificationType_group-invite',
|
|
|
|
|
'notificationType_new-register', 'notificationType_post-queue', 'notificationType_new-post-flag',
|
|
|
|
|
'notificationType_new-user-flag',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
notificationTypes.forEach(function (notificationType) {
|
|
|
|
|
if (data[notificationType]) {
|
|
|
|
|
settings[notificationType] = data[notificationType];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bootswatchSkin) {
|
|
|
|
|
settings.bootswatchSkin = data.bootswatchSkin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
|
function (next) {
|
|
|
|
|
notifications.getAllNotificationTypes(next);
|
|
|
|
|
},
|
|
|
|
|
function (notificationTypes, next) {
|
|
|
|
|
notificationTypes.forEach(function (notificationType) {
|
|
|
|
|
if (data[notificationType]) {
|
|
|
|
|
settings[notificationType] = data[notificationType];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
plugins.fireHook('filter:user.saveSettings', { settings: settings, data: data }, next);
|
|
|
|
|
},
|
|
|
|
|
function (result, next) {
|
|
|
|
|