Skip to content

Commit f456f3e

Browse files
committed
fix(fc): prevent any possible unread separator showing w/ count of 0
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent 6a28889 commit f456f3e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flipchatApp/src/main/kotlin/xyz/flipchat/app/features/chat/conversation/ConversationViewModel.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,14 +729,16 @@ class ConversationViewModel @Inject constructor(
729729
}
730730

731731
// if we have unread messages, insert a separator to call out
732+
val unreadCount = stateFlow.value.unreadCount ?: 0
732733
if (
733734
stateFlow.value.startAtUnread &&
734735
!unreadSeparatorInserted &&
735736
after?.chatMessageId?.uuid == stateFlow.value.lastReadMessage &&
736-
before?.sender?.isSelf == false
737+
before?.sender?.isSelf == false &&
738+
unreadCount > 0
737739
) {
738740
unreadSeparatorInserted = true
739-
return@insertSeparators ChatItem.UnreadSeparator(stateFlow.value.unreadCount ?: 0)
741+
return@insertSeparators ChatItem.UnreadSeparator(unreadCount)
740742
}
741743

742744
// No separator in other cases

0 commit comments

Comments
 (0)