diff --git a/spec/unit/models/event.spec.ts b/spec/unit/models/event.spec.ts index e4a0576da33..efb2404f6a6 100644 --- a/spec/unit/models/event.spec.ts +++ b/spec/unit/models/event.spec.ts @@ -308,4 +308,25 @@ describe("MatrixEvent", () => { }); }); }); + + it("should ignore thread relation on state events", async () => { + const stateEvent = new MatrixEvent({ + event_id: "$event_id", + type: "some_state_event", + content: { + "foo": "bar", + "m.relates_to": { + "event_id": "$thread_id", + "m.in_reply_to": { + event_id: "$thread_id", + }, + "rel_type": "m.thread", + }, + }, + state_key: "", + }); + + expect(stateEvent.isState()).toBeTruthy(); + expect(stateEvent.threadRootId).toBeUndefined(); + }); }); diff --git a/src/models/event.ts b/src/models/event.ts index 1790a9836da..378d37b2811 100644 --- a/src/models/event.ts +++ b/src/models/event.ts @@ -34,7 +34,7 @@ import { import { Crypto } from "../crypto"; import { deepSortedObjectEntries, internaliseString } from "../utils"; import { RoomMember } from "./room-member"; -import { Thread, ThreadEvent, ThreadEventHandlerMap, THREAD_RELATION_TYPE } from "./thread"; +import { Thread, THREAD_RELATION_TYPE, ThreadEvent, ThreadEventHandlerMap } from "./thread"; import { IActionsObject } from "../pushprocessor"; import { TypedReEmitter } from "../ReEmitter"; import { MatrixError } from "../http-api"; @@ -576,6 +576,10 @@ export class MatrixEvent extends TypedEventEmitter(THREAD_RELATION_TYPE.name); // Bundled relationships only returned when the sync response is limited @@ -1365,7 +1374,11 @@ export class MatrixEvent extends TypedEventEmitter