Skip to content

Commit

Permalink
fix: Thread unread not in unread group (#33963)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti authored Nov 18, 2024
1 parent df9ac15 commit a0d0c86
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sweet-needles-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes edge case of thread unread not being added to unread group
18 changes: 18 additions & 0 deletions apps/meteor/client/sidebarv2/hooks/useRoomList.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,21 @@ it('should accumulate unread data into `groupedUnreadInfo` when group is collaps
expect(tunread).toEqual(fakeRooms.reduce((acc, cv) => [...acc, ...(cv.tunread || [])], [] as string[]));
expect(tunreadUser).toEqual(fakeRooms.reduce((acc, cv) => [...acc, ...(cv.tunreadUser || [])], [] as string[]));
});

it('should add to unread group when has thread unread, even if alert is false', async () => {
const fakeRoom = {
...createFakeSubscription({ ...emptyUnread, tunread: ['1'], alert: false }),
} as unknown as SubscriptionWithRoom;

const { result } = renderHook(() => useRoomList({ collapsedGroups: [] }), {
legacyRoot: true,
wrapper: getWrapperSettings({
sidebarGroupByType: true,
sidebarShowUnread: true,
fakeRoom,
}).build(),
});

const unreadGroup = result.current.roomList.splice(0, result.current.groupsCount[0]);
expect(unreadGroup.find((room) => room.name === fakeRoom.name)).toBeDefined();
});
2 changes: 1 addition & 1 deletion apps/meteor/client/sidebarv2/hooks/useRoomList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const useRoomList = ({ collapsedGroups }: { collapsedGroups?: string[] })
return incomingCall.add(room);
}

if (sidebarShowUnread && (room.alert || room.unread) && !room.hideUnreadStatus) {
if (sidebarShowUnread && (room.alert || room.unread || room.tunread) && !room.hideUnreadStatus) {
return unread.add(room);
}

Expand Down

0 comments on commit a0d0c86

Please sign in to comment.