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.
This commit is contained in:
Bruno Windels
2019-07-02 13:12:13 +02:00
parent a4591afba6
commit 8eeb088e50
+5 -1
View File
@@ -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) {