mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-31 19:34:52 +01:00
Avoid mismatch between hasUnread and notificationCount because of unreadCount
With MSC2654 unread counts, it is possible such count is zero while the notification count isn't. So also respect the notification count when deciding if a chat has unread messages. Change-Id: I1b9f6ae907eb468c27fc0bb75b711db04268560a
This commit is contained in:
parent
c214e5daf1
commit
8a1da1c02f
@ -175,7 +175,12 @@ internal class RoomSummaryUpdater @Inject constructor(
|
||||
|
||||
val roomSummaryUnreadCount = roomSummaryEntity.unreadCount
|
||||
if (roomSummaryUnreadCount != null /* && preferences.prioritizeUnreadCountsOverRoomPreviewsForUnreadCalculation() */) {
|
||||
val hasUnreadMessages = roomSummaryUnreadCount > 0
|
||||
// MSC2654 says:
|
||||
// In case of a mismatch between this count and the value of notification_count in the Unread Notification Counts section,
|
||||
// clients should use the unread_count.
|
||||
// However, we do not do this here: if the notificationCount > 0, this means we likely got a push notification. Accordingly, it would be confusing
|
||||
// not to show such chat as unread. We can test this e.g. with edits: the unreadCount doesn't count edits, but the notification push rules do.
|
||||
val hasUnreadMessages = roomSummaryUnreadCount > 0 || roomSummaryEntity.notificationCount > 0
|
||||
roomSummaryEntity.hasUnreadMessages = hasUnreadMessages
|
||||
roomSummaryEntity.hasUnreadContentMessages = hasUnreadMessages
|
||||
roomSummaryEntity.hasUnreadOriginalContentMessages = hasUnreadMessages
|
||||
|
Loading…
x
Reference in New Issue
Block a user