From ffc9fb34d057b7258e40891f8614ec09321d82d7 Mon Sep 17 00:00:00 2001 From: Rashmit Pankhania Date: Wed, 3 Jan 2024 17:51:38 +0530 Subject: [PATCH] #22606 Fix "Remove" button to users without "m.room.redaction" (#3981) * #22606 Fix "Remove" button to users without "m.room.redaction" permission This change makes the remove button NOT available to users without permissions * Fix lint Signed-off-by: Rashmit Pankhania --------- Signed-off-by: Rashmit Pankhania --- src/models/room-state.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/models/room-state.ts b/src/models/room-state.ts index e10e37de7b2..52d520be177 100644 --- a/src/models/room-state.ts +++ b/src/models/room-state.ts @@ -781,7 +781,9 @@ export class RoomState extends TypedEventEmitter // The user may have been the sender, but they can't redact their own message // if redactions are blocked. const canRedact = this.maySendEvent(EventType.RoomRedaction, userId); - if (mxEvent.getSender() === userId) return canRedact; + + if (!canRedact) return false; + if (mxEvent.getSender() === userId) return true; return this.hasSufficientPowerLevelFor("redact", member.powerLevel); }