Merge pull request #3411 from matrix-org/t3chguy/synapse_deactivate_memberinfo_no_room

Support Synapse deactivate on MemberInfo without Room (timeline pill)
This commit is contained in:
Michael Telatynski 2019-09-11 17:12:38 +01:00 committed by GitHub
commit 379fab8068
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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