You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-13 08:02:38 +03:00
Handle push rule changes in the RoomNotificationState
This commit is contained in:
@@ -37,6 +37,7 @@ export class RoomNotificationState extends EventEmitter implements IDestroyable,
|
|||||||
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);
|
||||||
MatrixClientPeg.get().on("Event.decrypted", this.handleRoomEventUpdate);
|
MatrixClientPeg.get().on("Event.decrypted", this.handleRoomEventUpdate);
|
||||||
|
MatrixClientPeg.get().on("accountData", this.handleAccountDataUpdate);
|
||||||
this.updateNotificationState();
|
this.updateNotificationState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ export class RoomNotificationState extends EventEmitter implements IDestroyable,
|
|||||||
this.room.removeListener("Room.redaction", this.handleRoomEventUpdate);
|
this.room.removeListener("Room.redaction", this.handleRoomEventUpdate);
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +80,12 @@ export class RoomNotificationState extends EventEmitter implements IDestroyable,
|
|||||||
this.updateNotificationState();
|
this.updateNotificationState();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private handleAccountDataUpdate = (ev: MatrixEvent) => {
|
||||||
|
if (ev.getType() === "m.push_rules") {
|
||||||
|
this.updateNotificationState();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private updateNotificationState() {
|
private updateNotificationState() {
|
||||||
const before = {count: this.count, symbol: this.symbol, color: this.color};
|
const before = {count: this.count, symbol: this.symbol, color: this.color};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user