mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
Listen for our own membership changes on notification states
Fixes https://github.com/vector-im/riot-web/issues/14798 (part 1) When we transition from invite to not-invite we need to ensure we clear the invite notification state.
This commit is contained in:
parent
5b15d12865
commit
da05cac1b6
@ -31,6 +31,7 @@ export class RoomNotificationState extends NotificationState implements IDestroy
|
||||
this.room.on("Room.receipt", this.handleReadReceipt);
|
||||
this.room.on("Room.timeline", this.handleRoomEventUpdate);
|
||||
this.room.on("Room.redaction", this.handleRoomEventUpdate);
|
||||
this.room.on("Room.myMembership", this.handleMembershipUpdate);
|
||||
MatrixClientPeg.get().on("Event.decrypted", this.handleRoomEventUpdate);
|
||||
MatrixClientPeg.get().on("accountData", this.handleAccountDataUpdate);
|
||||
this.updateNotificationState();
|
||||
@ -45,6 +46,7 @@ export class RoomNotificationState extends NotificationState implements IDestroy
|
||||
this.room.removeListener("Room.receipt", this.handleReadReceipt);
|
||||
this.room.removeListener("Room.timeline", this.handleRoomEventUpdate);
|
||||
this.room.removeListener("Room.redaction", this.handleRoomEventUpdate);
|
||||
this.room.removeListener("Room.myMembership", this.handleMembershipUpdate);
|
||||
if (MatrixClientPeg.get()) {
|
||||
MatrixClientPeg.get().removeListener("Event.decrypted", this.handleRoomEventUpdate);
|
||||
MatrixClientPeg.get().removeListener("accountData", this.handleAccountDataUpdate);
|
||||
@ -57,6 +59,10 @@ export class RoomNotificationState extends NotificationState implements IDestroy
|
||||
this.updateNotificationState();
|
||||
};
|
||||
|
||||
private handleMembershipUpdate = () => {
|
||||
this.updateNotificationState();
|
||||
};
|
||||
|
||||
private handleRoomEventUpdate = (event: MatrixEvent) => {
|
||||
const roomId = event.getRoomId();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user