Skip to content

Commit

Permalink
Consider cases where the sender may not redact their own event
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Ralston <travpc@gmail.com>
  • Loading branch information
turt2live committed Oct 14, 2017
1 parent f5f8867 commit b70c219
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/models/room-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,11 @@ RoomState.prototype.maySendRedactionForEvent = function(mxEvent, userId) {
if (!member || member.membership === 'leave') return false;

if (mxEvent.status || mxEvent.isRedacted()) return false;
if (mxEvent.getSender() === userId) return true;

// The user may have been the sender, but they can't redact their own message
// if redactions are blocked.
const canRedact = this.maySendEvent("m.room.redaction", userId);
if (mxEvent.getSender() === userId) return canRedact;

return this._hasSufficientPowerLevelFor('redact', member.powerLevel);
};
Expand Down

0 comments on commit b70c219

Please sign in to comment.