Use creation content to signal virtual-ness

This makes things a lot simpler.
This commit is contained in:
David Baker 2021-02-17 18:51:21 +00:00
parent e787d11c73
commit 6130bdf0d2
5 changed files with 58 additions and 60 deletions

View file

@ -63,9 +63,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
}
this.emit(LISTS_UPDATE_EVENT);
});
// When new rooms arrive, we may hold them here until we have enough info to know whether we should before display them.
private roomHoldingPen: Room[] = [];
private holdNewRooms = false;
private readonly watchedSettings = [
'feature_custom_tags',
@ -129,24 +126,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
this.updateFn.trigger();
}
// After calling this, any new rooms that appear are not displayed until stopHoldingNewRooms()
// is called. Be sure to always call this in a try/finally block to ensure stopHoldingNewRooms
// is called afterwards.
public startHoldingNewRooms() {
console.log("hold-new-rooms mode enabled.");
this.holdNewRooms = true;
}
public stopHoldingNewRooms() {
console.log("hold-new-rooms mode disabled: processing " + this.roomHoldingPen.length + " held rooms");
this.holdNewRooms = false;
for (const heldRoom of this.roomHoldingPen) {
console.log("Processing held room: " + heldRoom.roomId);
this.handleRoomUpdate(heldRoom, RoomUpdateCause.NewRoom);
}
this.roomHoldingPen = [];
}
private checkLoggingEnabled() {
if (SettingsStore.getValue("advancedRoomListLogging")) {
console.warn("Advanced room list logging is enabled");
@ -420,18 +399,12 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
private async handleRoomUpdate(room: Room, cause: RoomUpdateCause): Promise<any> {
if (cause === RoomUpdateCause.NewRoom) {
if (this.holdNewRooms) {
console.log("Room updates are held: putting room " + room.roomId + " into the holding pen");
this.roomHoldingPen.push(room);
return;
} else {
// Let the visibility provider know that there is a new invited room. It would be nice
// if this could just be an event that things listen for but the point of this is that
// we delay doing anything about this room until the VoipUserMapper had had a chance
// to do the things it needs to do to decide if we should show this room or not, so
// an even wouldn't et us do that.
await VisibilityProvider.instance.onNewInvitedRoom(room);
}
// Let the visibility provider know that there is a new invited room. It would be nice
// if this could just be an event that things listen for but the point of this is that
// we delay doing anything about this room until the VoipUserMapper had had a chance
// to do the things it needs to do to decide if we should show this room or not, so
// an even wouldn't et us do that.
await VisibilityProvider.instance.onNewInvitedRoom(room);
}
if (!VisibilityProvider.instance.isRoomVisible(room)) {

View file

@ -42,7 +42,7 @@ export class VisibilityProvider {
if (
CallHandler.sharedInstance().getSupportsVirtualRooms() &&
VoipUserMapper.sharedInstance().isVirtualRoom(room.roomId)
VoipUserMapper.sharedInstance().isVirtualRoom(room)
) {
isVisible = false;
forced = true;