From 0b56e7a81c1f54b675a02d6b3f3bab637d90d270 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 10 Sep 2019 08:26:10 +0100 Subject: [PATCH] Support Synapse deactivate on MemberInfo without Room (timeline pill) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/MemberInfo.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index cb11cf39ad..dc9f1070fd 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -642,7 +642,10 @@ module.exports = createReactClass({ _calculateOpsPermissions: async function(member) { const defaultPerms = { - can: {}, + can: { + // Calculate permissions for Synapse before doing the PL checks + synapseDeactivate: await this.context.matrixClient.isSynapseAdministrator(), + }, muted: false, }; const room = this.context.matrixClient.getRoom(member.roomId); @@ -656,9 +659,10 @@ module.exports = createReactClass({ const them = member; return { - can: await this._calculateCanPermissions( - me, them, powerLevels.getContent(), - ), + can: { + ...defaultPerms.can, + ...await this._calculateCanPermissions(me, them, powerLevels.getContent()), + }, muted: this._isMuted(them, powerLevels.getContent()), isTargetMod: them.powerLevel > powerLevels.getContent().users_default, }; @@ -675,9 +679,6 @@ module.exports = createReactClass({ redactMessages: false, }; - // Calculate permissions for Synapse before doing the PL checks - can.synapseDeactivate = await this.context.matrixClient.isSynapseAdministrator(); - const canAffectUser = them.powerLevel < me.powerLevel || isMe; if (!canAffectUser) { //console.log("Cannot affect user: %s >= %s", them.powerLevel, me.powerLevel);