Fix default thread notification of the new RoomHeader (#12194)
parent
a5f9df5855
commit
a3a387a1dd
|
@ -44,9 +44,12 @@ export const useRoomThreadNotifications = (room: Room): NotificationLevel => {
|
|||
// If the current thread has unread messages, we're done.
|
||||
if (doesRoomOrThreadHaveUnreadMessages(thread)) {
|
||||
setNotificationLevel(NotificationLevel.Activity);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// default case
|
||||
setNotificationLevel(NotificationLevel.None);
|
||||
}, [room]);
|
||||
|
||||
useEventEmitter(room, RoomEvent.UnreadNotifications, updateNotification);
|
||||
|
|
|
@ -44,6 +44,13 @@ describe("useRoomThreadNotifications", () => {
|
|||
expect(result.current).toBe(NotificationLevel.None);
|
||||
});
|
||||
|
||||
it("returns none if the thread hasn't a notification anymore", async () => {
|
||||
room.setThreadUnreadNotificationCount("flooble", NotificationCountType.Highlight, 0);
|
||||
const { result } = render(room);
|
||||
|
||||
expect(result.current).toBe(NotificationLevel.None);
|
||||
});
|
||||
|
||||
it("returns red if a thread in the room has a highlight notification", async () => {
|
||||
room.setThreadUnreadNotificationCount("flooble", NotificationCountType.Highlight, 1);
|
||||
const { result } = render(room);
|
||||
|
@ -58,7 +65,7 @@ describe("useRoomThreadNotifications", () => {
|
|||
expect(result.current).toBe(NotificationLevel.Notification);
|
||||
});
|
||||
|
||||
it("returns bold if a thread in the room unread messages", async () => {
|
||||
it("returns activity if a thread in the room unread messages", async () => {
|
||||
await populateThread({
|
||||
room,
|
||||
client: cli,
|
||||
|
|
Loading…
Reference in New Issue