Skip to content
Snippets Groups Projects
Commit 0f2846fc authored by David Baker's avatar David Baker
Browse files

Re-use doesRoomHaveUnreadThreads for useRoomThreadNotifications

This incorporates the logic of not showing unread dots if the room
is muted
parent 7c84953a
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ import { NotificationCountType, Room, RoomEvent, ThreadEvent } from "matrix-js-s
import { useCallback, useEffect, useState } from "react";
import { NotificationLevel } from "../../stores/notifications/NotificationLevel";
import { doesRoomOrThreadHaveUnreadMessages } from "../../Unread";
import { doesRoomHaveUnreadThreads } from "../../Unread";
import { useEventEmitter } from "../useEventEmitter";
/**
......@@ -40,13 +40,7 @@ export const useRoomThreadNotifications = (room: Room): NotificationLevel => {
}
// We don't have any notified messages, but we might have unread messages. Let's
// find out.
for (const thread of room!.getThreads()) {
// If the current thread has unread messages, we're done.
if (doesRoomOrThreadHaveUnreadMessages(thread)) {
setNotificationLevel(NotificationLevel.Activity);
break;
}
}
if (doesRoomHaveUnreadThreads(room)) setNotificationLevel(NotificationLevel.Activity);
}, [room]);
useEventEmitter(room, RoomEvent.UnreadNotifications, updateNotification);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment