Prevent invites from showing up in breadcrumbs (#8344)
This commit is contained in:
parent
5976f59827
commit
d717d06ce5
1 changed files with 7 additions and 3 deletions
|
@ -26,6 +26,7 @@ import { SettingLevel } from "../settings/SettingLevel";
|
||||||
import { Action } from "../dispatcher/actions";
|
import { Action } from "../dispatcher/actions";
|
||||||
import { SettingUpdatedPayload } from "../dispatcher/payloads/SettingUpdatedPayload";
|
import { SettingUpdatedPayload } from "../dispatcher/payloads/SettingUpdatedPayload";
|
||||||
import { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload";
|
import { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload";
|
||||||
|
import { JoinRoomPayload } from "../dispatcher/payloads/JoinRoomPayload";
|
||||||
|
|
||||||
const MAX_ROOMS = 20; // arbitrary
|
const MAX_ROOMS = 20; // arbitrary
|
||||||
const AUTOJOIN_WAIT_THRESHOLD_MS = 90000; // 90s, the time we wait for an autojoined room to show up
|
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;
|
return this.matrixClient?.getVisibleRooms().length >= 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async onAction(payload: SettingUpdatedPayload | ViewRoomPayload) {
|
protected async onAction(payload: SettingUpdatedPayload | ViewRoomPayload | JoinRoomPayload) {
|
||||||
if (!this.matrixClient) return;
|
if (!this.matrixClient) return;
|
||||||
|
|
||||||
if (payload.action === Action.SettingUpdated) {
|
if (payload.action === Action.SettingUpdated) {
|
||||||
if (payload.settingName === 'breadcrumb_rooms') {
|
if (payload.settingName === 'breadcrumb_rooms') {
|
||||||
await this.updateRooms();
|
await this.updateRooms();
|
||||||
|
@ -84,8 +84,12 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
|
||||||
} else {
|
} else {
|
||||||
// The tests might not result in a valid room object.
|
// The tests might not result in a valid room object.
|
||||||
const room = this.matrixClient.getRoom(payload.room_id);
|
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 a new issue