This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree 2 files changed +27
-5
lines changed
2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -765,7 +765,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
765
765
766
766
const hiddenChildren = new EnhancedMap < string , Set < string > > ( ) ;
767
767
visibleRooms . forEach ( ( room ) => {
768
- if ( room . getMyMembership ( ) !== "join" ) return ;
768
+ if ( ! [ "join" , "invite" ] . includes ( room . getMyMembership ( ) ) ) return ;
769
769
this . getParents ( room . roomId ) . forEach ( ( parent ) => {
770
770
hiddenChildren . getOrCreate ( parent . roomId , new Set ( ) ) . add ( room . roomId ) ;
771
771
} ) ;
@@ -872,10 +872,9 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
872
872
}
873
873
874
874
const notificationStatesToUpdate = [ ...changeSet ] ;
875
- if (
876
- this . enabledMetaSpaces . includes ( MetaSpace . People ) &&
877
- userDiff . added . length + userDiff . removed . length + usersChanged . length > 0
878
- ) {
875
+ // We update the People metaspace even if we didn't detect any changes
876
+ // as roomIdsBySpace does not pre-calculate it so we have to assume it could have changed
877
+ if ( this . enabledMetaSpaces . includes ( MetaSpace . People ) ) {
879
878
notificationStatesToUpdate . push ( MetaSpace . People ) ;
880
879
}
881
880
this . updateNotificationStates ( notificationStatesToUpdate ) ;
Original file line number Diff line number Diff line change @@ -672,6 +672,29 @@ describe("SpaceStore", () => {
672
672
} ) ;
673
673
} ) ;
674
674
675
+ it ( "should add new DM Invites to the People Space Notification State" , async ( ) => {
676
+ mkRoom ( dm1 ) ;
677
+ mocked ( client . getRoom ( dm1 ) ! ) . getMyMembership . mockReturnValue ( "join" ) ;
678
+ mocked ( client ) . getRoom . mockImplementation ( ( roomId ) => rooms . find ( ( room ) => room . roomId === roomId ) || null ) ;
679
+
680
+ await run ( ) ;
681
+
682
+ mkRoom ( dm2 ) ;
683
+ const cliDm2 = client . getRoom ( dm2 ) ! ;
684
+ mocked ( cliDm2 ) . getMyMembership . mockReturnValue ( "invite" ) ;
685
+ mocked ( client ) . getRoom . mockImplementation ( ( roomId ) => rooms . find ( ( room ) => room . roomId === roomId ) || null ) ;
686
+ client . emit ( RoomEvent . MyMembership , cliDm2 , "invite" ) ;
687
+
688
+ [ dm1 , dm2 ] . forEach ( ( d ) => {
689
+ expect (
690
+ store
691
+ . getNotificationState ( MetaSpace . People )
692
+ . rooms . map ( ( r ) => r . roomId )
693
+ . includes ( d ) ,
694
+ ) . toBeTruthy ( ) ;
695
+ } ) ;
696
+ } ) ;
697
+
675
698
describe ( "hierarchy resolution update tests" , ( ) => {
676
699
it ( "updates state when spaces are joined" , async ( ) => {
677
700
await run ( ) ;
You can’t perform that action at this time.
0 commit comments