Prevent invites from showing up in breadcrumbs (#8344)

pull/28217/head
Sinharitik589 2022-05-17 19:38:36 +05:30 committed by GitHub
parent 5976f59827
commit d717d06ce5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import { SettingLevel } from "../settings/SettingLevel";
import { Action } from "../dispatcher/actions";
import { SettingUpdatedPayload } from "../dispatcher/payloads/SettingUpdatedPayload";
import { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload";
import { JoinRoomPayload } from "../dispatcher/payloads/JoinRoomPayload";
const MAX_ROOMS = 20; // arbitrary
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> {
return this.matrixClient?.getVisibleRooms().length >= 20;
}
protected async onAction(payload: SettingUpdatedPayload | ViewRoomPayload) {
protected async onAction(payload: SettingUpdatedPayload | ViewRoomPayload | JoinRoomPayload) {
if (!this.matrixClient) return;
if (payload.action === Action.SettingUpdated) {
if (payload.settingName === 'breadcrumb_rooms') {
await this.updateRooms();
@ -84,8 +84,12 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
} else {
// The tests might not result in a valid room object.
const room = this.matrixClient.getRoom(payload.room_id);
if (room) await this.appendRoom(room);
const membership = room?.getMyMembership();
if (room && membership==="join") await this.appendRoom(room);
}
} else if (payload.action === Action.JoinRoom) {
const room = this.matrixClient.getRoom(payload.roomId);
if (room) await this.appendRoom(room);
}
}