Skip to content

Commit

Permalink
#22606 Fix "Remove" button to users without "m.room.redaction" (matri…
Browse files Browse the repository at this point in the history
…x-org#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 <[email protected]>

---------

Signed-off-by: Rashmit Pankhania <[email protected]>
  • Loading branch information
rashmitpankhania authored Jan 3, 2024
1 parent d030c83 commit ffc9fb3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/models/room-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,9 @@ export class RoomState extends TypedEventEmitter<EmittedEvents, EventHandlerMap>
// 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);
}
Expand Down

0 comments on commit ffc9fb3

Please sign in to comment.