Support Synapse deactivate on MemberInfo without Room (timeline pill)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2019-09-10 08:26:10 +01:00 committed by Travis Ralston
parent d394e76254
commit 3fef6e6b22
1 changed files with 8 additions and 7 deletions

View File

@ -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);