Skip to content

Commit

Permalink
[PAY-1394] DMs: Show global unread indicator if there's unread messag…
Browse files Browse the repository at this point in the history
…es in a loaded chat (#3533)
  • Loading branch information
rickyrombo authored Jun 7, 2023
1 parent 40abf58 commit 7ae88cb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/common/src/store/pages/chat/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,18 @@ export const getUnreadMessagesCount = (state: CommonState) => {
return state.pages.chat.unreadMessagesCount
}

export const getHasUnreadMessages = (state: CommonState) =>
getUnreadMessagesCount(state) > 0
export const getHasUnreadMessages = (state: CommonState) => {
if (getUnreadMessagesCount(state) > 0) {
return true
}
const chats = getChats(state)
for (const chat of chats) {
if (chat.unread_message_count > 0) {
return true
}
}
return false
}

export const getOtherChatUsersFromChat = (
state: CommonState,
Expand Down

0 comments on commit 7ae88cb

Please sign in to comment.