From 3fef6e6b22306b32604f1f05663cf755e66e6794 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 867e50ba0d..1b4c13db2c 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -637,7 +637,10 @@ module.exports = withMatrixClient(React.createClass({ _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.props.matrixClient.getRoom(member.roomId); @@ -651,9 +654,10 @@ module.exports = withMatrixClient(React.createClass({ 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, }; @@ -670,9 +674,6 @@ module.exports = withMatrixClient(React.createClass({ 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);