File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -412,9 +412,11 @@ class NotifierClass {
412
412
removed : boolean ,
413
413
data : IRoomTimelineData ,
414
414
) : void => {
415
- if ( ! data . liveEvent ) return ; // only notify for new things, not old.
415
+ if ( removed ) return ; // only notify for new events, not removed ones
416
+ if ( ! data . liveEvent || ! ! toStartOfTimeline ) return ; // only notify for new things, not old.
416
417
if ( ! this . isSyncing ) return ; // don't alert for any messages initially
417
418
if ( ev . getSender ( ) === MatrixClientPeg . safeGet ( ) . getUserId ( ) ) return ;
419
+ if ( data . timeline . getTimelineSet ( ) . threadListType !== null ) return ; // Ignore events on the thread list generated timelines
418
420
419
421
MatrixClientPeg . safeGet ( ) . decryptEventIfNeeded ( ev ) ;
420
422
Original file line number Diff line number Diff line change @@ -538,4 +538,28 @@ describe("Notifier", () => {
538
538
expect ( localStorage . getItem ( "notifications_hidden" ) ) . toBeTruthy ( ) ;
539
539
} ) ;
540
540
} ) ;
541
+
542
+ describe ( "onEvent" , ( ) => {
543
+ it ( "should not evaluate events from the thread list fake timeline sets" , async ( ) => {
544
+ mockClient . supportsThreads . mockReturnValue ( true ) ;
545
+
546
+ const fn = jest . spyOn ( Notifier , "evaluateEvent" ) ;
547
+
548
+ await testRoom . createThreadsTimelineSets ( ) ;
549
+ testRoom . threadsTimelineSets [ 0 ] ! . addEventToTimeline (
550
+ mkEvent ( {
551
+ event : true ,
552
+ type : "m.room.message" ,
553
+ user : "@user1:server" ,
554
+ room : roomId ,
555
+ content : { body : "this is a thread root" } ,
556
+ } ) ,
557
+ testRoom . threadsTimelineSets [ 0 ] ! . getLiveTimeline ( ) ,
558
+ false ,
559
+ false ,
560
+ ) ;
561
+
562
+ expect ( fn ) . not . toHaveBeenCalled ( ) ;
563
+ } ) ;
564
+ } ) ;
541
565
} ) ;
You can’t perform that action at this time.
0 commit comments