This commit is contained in:
Barış Soner Uşaklı
2018-05-28 13:30:11 -04:00
parent c38751cec3
commit 6eea11a4fd
8 changed files with 45 additions and 23 deletions

View File

@@ -31,6 +31,9 @@ module.exports = function (SocketUser) {
function (next) {
user.isAdminOrGlobalModOrSelf(socket.uid, data.uid, next);
},
function (next) {
user.checkMinReputation(socket.uid, data.uid, 'min:rep:cover-picture', next);
},
function (next) {
user.updateCoverPicture(data, next);
},
@@ -45,6 +48,9 @@ module.exports = function (SocketUser) {
function (next) {
user.isAdminOrGlobalModOrSelf(socket.uid, data.uid, next);
},
function (next) {
user.checkMinReputation(socket.uid, data.uid, 'min:rep:profile-picture', next);
},
function (next) {
user.uploadCroppedPicture(data, next);
},
@@ -204,15 +210,14 @@ module.exports = function (SocketUser) {
SocketUser.toggleBlock = function (socket, data, callback) {
async.waterfall([
function (next) {
user.blocks.can(data.uid, function (err, can) {
if (err || !can) {
return next(err || new Error('[[error:cannot-block-privileged]]'));
}
next();
});
user.blocks.can(data.uid, next);
},
function (can, next) {
if (!can) {
return next(new Error('[[error:cannot-block-privileged]]'));
}
user.blocks.is(data.uid, socket.uid, next);
},
async.apply(user.blocks.is, data.uid, socket.uid),
function (is, next) {
user.blocks[is ? 'remove' : 'add'](data.uid, socket.uid, next);
},