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.pull/21833/head
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.receipt", this.handleReadReceipt);
|
||||||
this.room.on("Room.timeline", this.handleRoomEventUpdate);
|
this.room.on("Room.timeline", this.handleRoomEventUpdate);
|
||||||
this.room.on("Room.redaction", 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("Event.decrypted", this.handleRoomEventUpdate);
|
||||||
MatrixClientPeg.get().on("accountData", this.handleAccountDataUpdate);
|
MatrixClientPeg.get().on("accountData", this.handleAccountDataUpdate);
|
||||||
this.updateNotificationState();
|
this.updateNotificationState();
|
||||||
|
@ -45,6 +46,7 @@ export class RoomNotificationState extends NotificationState implements IDestroy
|
||||||
this.room.removeListener("Room.receipt", this.handleReadReceipt);
|
this.room.removeListener("Room.receipt", this.handleReadReceipt);
|
||||||
this.room.removeListener("Room.timeline", this.handleRoomEventUpdate);
|
this.room.removeListener("Room.timeline", this.handleRoomEventUpdate);
|
||||||
this.room.removeListener("Room.redaction", this.handleRoomEventUpdate);
|
this.room.removeListener("Room.redaction", this.handleRoomEventUpdate);
|
||||||
|
this.room.removeListener("Room.myMembership", this.handleMembershipUpdate);
|
||||||
if (MatrixClientPeg.get()) {
|
if (MatrixClientPeg.get()) {
|
||||||
MatrixClientPeg.get().removeListener("Event.decrypted", this.handleRoomEventUpdate);
|
MatrixClientPeg.get().removeListener("Event.decrypted", this.handleRoomEventUpdate);
|
||||||
MatrixClientPeg.get().removeListener("accountData", this.handleAccountDataUpdate);
|
MatrixClientPeg.get().removeListener("accountData", this.handleAccountDataUpdate);
|
||||||
|
@ -57,6 +59,10 @@ export class RoomNotificationState extends NotificationState implements IDestroy
|
||||||
this.updateNotificationState();
|
this.updateNotificationState();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private handleMembershipUpdate = () => {
|
||||||
|
this.updateNotificationState();
|
||||||
|
};
|
||||||
|
|
||||||
private handleRoomEventUpdate = (event: MatrixEvent) => {
|
private handleRoomEventUpdate = (event: MatrixEvent) => {
|
||||||
const roomId = event.getRoomId();
|
const roomId = event.getRoomId();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue