Merge pull request #3437 from matrix-org/travis/fix-deactivate

Wrap deactivation check with sanity conditions
pull/21833/head
Travis Ralston 2019-09-13 15:59:04 -06:00 committed by GitHub
commit e18b38c409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -641,10 +641,15 @@ module.exports = createReactClass({
},
_calculateOpsPermissions: async function(member) {
let canDeactivate = false;
if (this.context.matrixClient) {
canDeactivate = await this.context.matrixClient.isSynapseAdministrator();
}
const defaultPerms = {
can: {
// Calculate permissions for Synapse before doing the PL checks
synapseDeactivate: await this.context.matrixClient.isSynapseAdministrator(),
synapseDeactivate: canDeactivate,
},
muted: false,
};
@ -668,7 +673,7 @@ module.exports = createReactClass({
};
},
_calculateCanPermissions: async function(me, them, powerLevels) {
_calculateCanPermissions: function(me, them, powerLevels) {
const isMe = me.userId === them.userId;
const can = {
kick: false,