@@ -2113,11 +2113,12 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
21132113 }
21142114
21152115 // A thread relation is always only shown in a thread
2116- if ( event . isRelation ( THREAD_RELATION_TYPE . name ) ) {
2116+ const threadRootId = event . threadRootId ;
2117+ if ( threadRootId != undefined ) {
21172118 return {
21182119 shouldLiveInRoom : false ,
21192120 shouldLiveInThread : true ,
2120- threadId : event . threadRootId ,
2121+ threadId : threadRootId ,
21212122 } ;
21222123 }
21232124
@@ -2148,15 +2149,6 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
21482149 } ;
21492150 }
21502151
2151- const unsigned = event . getUnsigned ( ) ;
2152- if ( typeof unsigned [ "org.matrix.msc4023.thread_id" ] === "string" ) {
2153- return {
2154- shouldLiveInRoom : false ,
2155- shouldLiveInThread : true ,
2156- threadId : unsigned [ "org.matrix.msc4023.thread_id" ] ,
2157- } ;
2158- }
2159-
21602152 // We've exhausted all scenarios,
21612153 // we cannot assume that it lives in the main timeline as this may be a relation for an unknown thread
21622154 return {
@@ -2888,12 +2880,9 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
28882880 private findThreadRoots ( events : MatrixEvent [ ] ) : Set < string > {
28892881 const threadRoots = new Set < string > ( ) ;
28902882 for ( const event of events ) {
2891- if ( event . isRelation ( THREAD_RELATION_TYPE . name ) ) {
2892- threadRoots . add ( event . relationEventId ?? "" ) ;
2893- }
2894- const unsigned = event . getUnsigned ( ) ;
2895- if ( typeof unsigned [ "org.matrix.msc4023.thread_id" ] === "string" ) {
2896- threadRoots . add ( unsigned [ "org.matrix.msc4023.thread_id" ] ) ;
2883+ const threadRootId = event . threadRootId ;
2884+ if ( threadRootId != undefined ) {
2885+ threadRoots . add ( threadRootId ) ;
28972886 }
28982887 }
28992888 return threadRoots ;
0 commit comments