fix promoted users not being able to execute moderator actions

This commit is contained in:
KDSBrowne 2017-10-06 08:18:27 -07:00
parent b20ab84abd
commit 5c1ff8efbc

View File

@ -2,8 +2,7 @@ import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import Users from '/imports/api/2.0/users';
export default function handleChangeRole({body}, meetingId) {
export default function handleChangeRole({ body }, meetingId) {
const { userId, role, changedBy } = body;
check(userId, String);
@ -15,9 +14,15 @@ export default function handleChangeRole({body}, meetingId) {
userId,
};
const userRoles = [
'viewer',
role === 'MODERATOR' ? 'moderator' : false,
].filter(Boolean);
const modifier = {
$set: {
role,
roles: userRoles,
},
};
@ -32,5 +37,4 @@ export default function handleChangeRole({body}, meetingId) {
};
return Users.update(selector, modifier, cb);
}