Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d717d06

Browse files
Prevent invites from showing up in breadcrumbs (#8344)
1 parent 5976f59 commit d717d06

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/stores/BreadcrumbsStore.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { SettingLevel } from "../settings/SettingLevel";
2626
import { Action } from "../dispatcher/actions";
2727
import { SettingUpdatedPayload } from "../dispatcher/payloads/SettingUpdatedPayload";
2828
import { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload";
29+
import { JoinRoomPayload } from "../dispatcher/payloads/JoinRoomPayload";
2930

3031
const MAX_ROOMS = 20; // arbitrary
3132
const 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

Comments
 (0)