@@ -26,6 +26,7 @@ import { SettingLevel } from "../settings/SettingLevel";
2626import { Action } from "../dispatcher/actions" ;
2727import { SettingUpdatedPayload } from "../dispatcher/payloads/SettingUpdatedPayload" ;
2828import { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload" ;
29+ import { JoinRoomPayload } from "../dispatcher/payloads/JoinRoomPayload" ;
2930
3031const MAX_ROOMS = 20 ; // arbitrary
3132const AUTOJOIN_WAIT_THRESHOLD_MS = 90000 ; // 90s, the time we wait for an autojoined room to show up
@@ -65,9 +66,8 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
6566 return this . matrixClient ?. getVisibleRooms ( ) . length >= 20 ;
6667 }
6768
68- protected async onAction ( payload : SettingUpdatedPayload | ViewRoomPayload ) {
69+ protected async onAction ( payload : SettingUpdatedPayload | ViewRoomPayload | JoinRoomPayload ) {
6970 if ( ! this . matrixClient ) return ;
70-
7171 if ( payload . action === Action . SettingUpdated ) {
7272 if ( payload . settingName === 'breadcrumb_rooms' ) {
7373 await this . updateRooms ( ) ;
@@ -84,8 +84,12 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
8484 } else {
8585 // The tests might not result in a valid room object.
8686 const room = this . matrixClient . getRoom ( payload . room_id ) ;
87- if ( room ) await this . appendRoom ( room ) ;
87+ const membership = room ?. getMyMembership ( ) ;
88+ if ( room && membership === "join" ) await this . appendRoom ( room ) ;
8889 }
90+ } else if ( payload . action === Action . JoinRoom ) {
91+ const room = this . matrixClient . getRoom ( payload . roomId ) ;
92+ if ( room ) await this . appendRoom ( room ) ;
8993 }
9094 }
9195
0 commit comments