1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

Ignore m.replace relations on state events, they're invalid (#2306)

* Ignore m.replace relations on state events, they're invalid

* Add tests

* Fix test

Co-authored-by: Kerry <kerrya@element.io>
This commit is contained in:
Michael Telatynski
2022-04-26 11:02:36 +01:00
committed by GitHub
parent ac08e52410
commit ba06e430c4
2 changed files with 49 additions and 0 deletions

View File

@@ -1336,6 +1336,10 @@ export class MatrixEvent extends TypedEventEmitter<EmittedEvents, MatrixEventHan
if (this.isRedacted() && newEvent) {
return;
}
// don't allow state events to be replaced using this mechanism as per MSC2676
if (this.isState()) {
return;
}
if (this._replacingEvent !== newEvent) {
this._replacingEvent = newEvent;
this.emit(MatrixEventEvent.Replaced, this);