Show thread notification if thread timeline is closed (#9495)

* Show thread notification if thread timeline is closed

* Simplify isViewingEventTimeline statement

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix show desktop notifications

* Add RoomViewStore thread id assertions

* Add Notifier tests

* fix lint

* Remove it.only

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Germain
2022-10-25 17:53:31 +01:00
committed by GitHub
parent d273441596
commit 306a2449e5
7 changed files with 178 additions and 21 deletions

View File

@@ -435,7 +435,16 @@ export const Notifier = {
if (actions?.notify) {
this._performCustomEventHandling(ev);
if (SdkContextClass.instance.roomViewStore.getRoomId() === room.roomId &&
const store = SdkContextClass.instance.roomViewStore;
const isViewingRoom = store.getRoomId() === room.roomId;
const threadId: string | undefined = ev.getId() !== ev.threadRootId
? ev.threadRootId
: undefined;
const isViewingThread = store.getThreadId() === threadId;
const isViewingEventTimeline = isViewingRoom && (!threadId || isViewingThread);
if (isViewingEventTimeline &&
UserActivity.sharedInstance().userActiveRecently() &&
!Modal.hasDialogs()
) {