mirror of https://github.com/vector-im/riot-web
Fix delayed badge update for mentions in encrypted rooms (#7813)
* Fix delayed badge update for mentions in encrypted rooms Fixes https://github.com/vector-im/element-web/issues/20859 More detail on the issue * Remove unused import * Fix listener removalpull/21833/head
parent
8d4e83084c
commit
a958cd20f1
|
@ -35,7 +35,7 @@ export class RoomNotificationState extends NotificationState implements IDestroy
|
||||||
this.room.on("Room.redaction", this.handleRoomEventUpdate);
|
this.room.on("Room.redaction", this.handleRoomEventUpdate);
|
||||||
this.room.on("Room.myMembership", this.handleMembershipUpdate);
|
this.room.on("Room.myMembership", this.handleMembershipUpdate);
|
||||||
this.room.on("Room.localEchoUpdated", this.handleLocalEchoUpdated);
|
this.room.on("Room.localEchoUpdated", this.handleLocalEchoUpdated);
|
||||||
MatrixClientPeg.get().on("Event.decrypted", this.handleRoomEventUpdate);
|
MatrixClientPeg.get().on("Event.decrypted", this.onEventDecrypted);
|
||||||
MatrixClientPeg.get().on("accountData", this.handleAccountDataUpdate);
|
MatrixClientPeg.get().on("accountData", this.handleAccountDataUpdate);
|
||||||
this.updateNotificationState();
|
this.updateNotificationState();
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ export class RoomNotificationState extends NotificationState implements IDestroy
|
||||||
this.room.removeListener("Room.myMembership", this.handleMembershipUpdate);
|
this.room.removeListener("Room.myMembership", this.handleMembershipUpdate);
|
||||||
this.room.removeListener("Room.localEchoUpdated", this.handleLocalEchoUpdated);
|
this.room.removeListener("Room.localEchoUpdated", this.handleLocalEchoUpdated);
|
||||||
if (MatrixClientPeg.get()) {
|
if (MatrixClientPeg.get()) {
|
||||||
MatrixClientPeg.get().removeListener("Event.decrypted", this.handleRoomEventUpdate);
|
MatrixClientPeg.get().removeListener("Event.decrypted", this.onEventDecrypted);
|
||||||
MatrixClientPeg.get().removeListener("accountData", this.handleAccountDataUpdate);
|
MatrixClientPeg.get().removeListener("accountData", this.handleAccountDataUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,15 @@ export class RoomNotificationState extends NotificationState implements IDestroy
|
||||||
this.updateNotificationState();
|
this.updateNotificationState();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private onEventDecrypted = (event: MatrixEvent) => {
|
||||||
|
if (event.getRoomId() !== this.room.roomId) return; // ignore - not for us or notifications timeline
|
||||||
|
|
||||||
|
this.updateNotificationState();
|
||||||
|
};
|
||||||
|
|
||||||
private handleRoomEventUpdate = (event: MatrixEvent, room: Room | null) => {
|
private handleRoomEventUpdate = (event: MatrixEvent, room: Room | null) => {
|
||||||
if (room?.roomId !== this.room.roomId) return; // ignore - not for us or notifications timeline
|
if (room?.roomId !== this.room.roomId) return; // ignore - not for us or notifications timeline
|
||||||
|
|
||||||
this.updateNotificationState();
|
this.updateNotificationState();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue