Hook threads notification state to UI (#7298)
This commit is contained in:
parent
55eda7314b
commit
ce570ab827
6 changed files with 139 additions and 28 deletions
|
@ -40,20 +40,26 @@ export class ThreadNotificationState extends NotificationState implements IDestr
|
|||
this.thread.off(ThreadEvent.ViewThread, this.resetThreadNotification);
|
||||
}
|
||||
|
||||
private handleNewThreadReply(thread: Thread, event: MatrixEvent) {
|
||||
private handleNewThreadReply = (thread: Thread, event: MatrixEvent) => {
|
||||
const client = MatrixClientPeg.get();
|
||||
|
||||
const isOwn = client.getUserId() === event.getSender();
|
||||
if (!isOwn) {
|
||||
const myUserId = client.getUserId();
|
||||
|
||||
const isOwn = myUserId === event.getSender();
|
||||
const readReceipt = this.room.getReadReceiptForUserId(myUserId);
|
||||
|
||||
if (!isOwn && !readReceipt || event.getTs() >= readReceipt.data.ts) {
|
||||
const actions = client.getPushActionsForEvent(event, true);
|
||||
|
||||
const color = !!actions.tweaks.highlight
|
||||
? NotificationColor.Red
|
||||
: NotificationColor.Grey;
|
||||
if (actions?.tweaks) {
|
||||
const color = !!actions.tweaks.highlight
|
||||
? NotificationColor.Red
|
||||
: NotificationColor.Grey;
|
||||
|
||||
this.updateNotificationState(color);
|
||||
this.updateNotificationState(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private resetThreadNotification = (): void => {
|
||||
this.updateNotificationState(NotificationColor.None);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue