Skip to content

Commit

Permalink
Merge pull request #556 from turt2live/travis/improved-redact-check
Browse files Browse the repository at this point in the history
Consider cases where the sender may not redact their own event
  • Loading branch information
ara4n authored Nov 14, 2017
2 parents 7a59579 + b70c219 commit d357283
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 @@ -268,7 +268,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 d357283

Please sign in to comment.