mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 05:04:57 +08:00
Prevent invites from showing up in breadcrumbs (#8344)
This commit is contained in:
parent
5976f59827
commit
d717d06ce5
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user