mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 10:35:55 +01:00
closes #4194
This commit is contained in:
@@ -188,12 +188,20 @@ SocketUser.saveSettings = function(socket, data, callback) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
user.isAdminOrSelf(socket.uid, data.uid, function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
if (socket.uid === parseInt(data.uid, 10)) {
|
||||
return next(null, true);
|
||||
}
|
||||
user.isAdminOrGlobalMod(socket.uid, next);
|
||||
},
|
||||
function(allowed, next) {
|
||||
if (!allowed) {
|
||||
return next(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
user.saveSettings(data.uid, data.settings, next);
|
||||
}
|
||||
user.saveSettings(data.uid, data.settings, callback);
|
||||
});
|
||||
], callback);
|
||||
};
|
||||
|
||||
SocketUser.setTopicSort = function(socket, sort, callback) {
|
||||
|
||||
Reference in New Issue
Block a user