Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Wrap deactivation check with sanity conditions #3437

Merged
merged 3 commits into from
Sep 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/components/views/rooms/MemberInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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,
Expand Down