@@ -69,6 +69,7 @@ export function shouldFormContinuation(
6969 prevEvent : MatrixEvent ,
7070 mxEvent : MatrixEvent ,
7171 showHiddenEvents : boolean ,
72+ threadsEnabled : boolean ,
7273 timelineRenderingType ?: TimelineRenderingType ,
7374) : boolean {
7475 if ( timelineRenderingType === TimelineRenderingType . ThreadsList ) return false ;
@@ -90,6 +91,9 @@ export function shouldFormContinuation(
9091 mxEvent . sender . name !== prevEvent . sender . name ||
9192 mxEvent . sender . getMxcAvatarUrl ( ) !== prevEvent . sender . getMxcAvatarUrl ( ) ) return false ;
9293
94+ // Thread summaries should break up a continuation
95+ if ( threadsEnabled && prevEvent . isThreadRoot ) return false ;
96+
9397 // if we don't have tile for previous event then it was shown by showHiddenEvents and has no SenderProfile
9498 if ( ! haveTileForEvent ( prevEvent , showHiddenEvents ) ) return false ;
9599
@@ -241,6 +245,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
241245 private readReceiptsByUserId : Record < string , IReadReceiptForUser > = { } ;
242246
243247 private readonly showHiddenEventsInTimeline : boolean ;
248+ private readonly threadsEnabled : boolean ;
244249 private isMounted = false ;
245250
246251 private readMarkerNode = createRef < HTMLLIElement > ( ) ;
@@ -264,10 +269,11 @@ export default class MessagePanel extends React.Component<IProps, IState> {
264269 hideSender : this . shouldHideSender ( ) ,
265270 } ;
266271
267- // Cache hidden events setting on mount since Settings is expensive to
268- // query, and we check this in a hot code path. This is also cached in
269- // our RoomContext, however we still need a fallback for roomless MessagePanels.
272+ // Cache these settings on mount since Settings is expensive to query,
273+ // and we check this in a hot code path. This is also cached in our
274+ // RoomContext, however we still need a fallback for roomless MessagePanels.
270275 this . showHiddenEventsInTimeline = SettingsStore . getValue ( "showHiddenEventsInTimeline" ) ;
276+ this . threadsEnabled = SettingsStore . getValue ( "feature_thread" ) ;
271277
272278 this . showTypingNotificationsWatcherRef =
273279 SettingsStore . watchSetting ( "showTypingNotifications" , null , this . onShowTypingNotificationsChange ) ;
@@ -465,7 +471,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
465471
466472 // TODO: Implement granular (per-room) hide options
467473 public shouldShowEvent ( mxEv : MatrixEvent , forceHideEvents = false ) : boolean {
468- if ( this . props . hideThreadedMessages && SettingsStore . getValue ( "feature_thread" ) ) {
474+ if ( this . props . hideThreadedMessages && this . threadsEnabled ) {
469475 if ( mxEv . isThreadRelation ) {
470476 return false ;
471477 }
@@ -744,12 +750,16 @@ export default class MessagePanel extends React.Component<IProps, IState> {
744750 lastInSection = willWantDateSeparator ||
745751 mxEv . getSender ( ) !== nextEv . getSender ( ) ||
746752 getEventDisplayInfo ( nextEv ) . isInfoMessage ||
747- ! shouldFormContinuation ( mxEv , nextEv , this . showHiddenEvents , this . context . timelineRenderingType ) ;
753+ ! shouldFormContinuation (
754+ mxEv , nextEv , this . showHiddenEvents , this . threadsEnabled , this . context . timelineRenderingType ,
755+ ) ;
748756 }
749757
750758 // is this a continuation of the previous message?
751759 const continuation = ! wantsDateSeparator &&
752- shouldFormContinuation ( prevEvent , mxEv , this . showHiddenEvents , this . context . timelineRenderingType ) ;
760+ shouldFormContinuation (
761+ prevEvent , mxEv , this . showHiddenEvents , this . threadsEnabled , this . context . timelineRenderingType ,
762+ ) ;
753763
754764 const eventId = mxEv . getId ( ) ;
755765 const highlight = ( eventId === this . props . highlightedEventId ) ;
0 commit comments