fix promoted users not being able to execute moderator actions
This commit is contained in:
parent
b20ab84abd
commit
5c1ff8efbc
@ -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);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user