diff --git a/src/user.js b/src/user.js index ec9fa2b56..e5beaf275 100644 --- a/src/user.js +++ b/src/user.js @@ -296,6 +296,14 @@ function setGroups(userId, groupIds, callback) { if (error && error.reason === GroupError.NOT_FOUND) return callback(new UserError(UserError.NOT_FOUND, 'One or more groups not found')); if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error)); + if (groupIds.some(function (g) { return g === groups.ADMIN_GROUP_ID; })) { + getUser(userId, function (error, result) { + if (error) return console.error('Failed to send admin change mail.', error); + + mailer.adminChanged(result, true); + }); + } + callback(); }); }