This commit is contained in:
Barış Soner Uşaklı
2019-04-13 05:04:06 -04:00
parent c38db4f765
commit ba5e1eaa4f
2 changed files with 24 additions and 2 deletions

View File

@@ -28,8 +28,20 @@ User.makeAdmins = function (socket, uids, callback) {
}
}
async.each(uids, function (uid, next) {
groups.join('administrators', uid, next);
async.eachSeries(uids, function (uid, next) {
async.waterfall([
function (next) {
groups.join('administrators', uid, next);
},
function (next) {
events.log({
type: 'user-makeAdmin',
uid: socket.uid,
targetUid: uid,
ip: socket.ip,
}, next);
},
], next);
}, next);
},
], callback);
@@ -52,6 +64,14 @@ User.removeAdmins = function (socket, uids, callback) {
groups.leave('administrators', uid, next);
},
function (next) {
events.log({
type: 'user-removeAdmin',
uid: socket.uid,
targetUid: uid,
ip: socket.ip,
}, next);
},
], next);
}, callback);
};