From 8eeb088e5085b2d2ea2eef58a09d1153ecea98ea Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 2 Jul 2019 13:12:13 +0200 Subject: [PATCH] allow to clear replacement on redacted events this is needed when cancelling sending anything related to an event, to not keep the event as edited when we cancel the edit before the redaction. --- src/models/event.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/models/event.js b/src/models/event.js index 0a8fbbf48..f7ac2430e 100644 --- a/src/models/event.js +++ b/src/models/event.js @@ -869,7 +869,11 @@ utils.extend(module.exports.MatrixEvent.prototype, { * @param {MatrixEvent?} newEvent the event with the replacing content, if any. */ makeReplaced(newEvent) { - if (this.isRedacted()) { + // don't allow redacted events to be replaced. + // if newEvent is null we allow to go through though, + // as with local redaction, the replacing event might get + // cancelled, which should be reflected on the target event. + if (this.isRedacted() && newEvent) { return; } if (this._replacingEvent !== newEvent) {