Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
prevent unread event for room with empty timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulf Seltmann committed Aug 8, 2022
1 parent 94f3168 commit 2cd2f60
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Unread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export function eventTriggersUnreadCount(ev: MatrixEvent): boolean {
}

export function doesRoomHaveUnreadMessages(room: Room): boolean {
// if there is no timeline at all, e.g. by message retention
if (room.timeline.length === 0) {
return false;
}

const myUserId = MatrixClientPeg.get().getUserId();

// get the most recent read receipt sent by our account.
Expand Down

0 comments on commit 2cd2f60

Please sign in to comment.