Always mark chats as unread if they have an unread count > 0

Fixes chats not being marked as unread that have a high non-message
event amount.

Change-Id: I441fd21c3719109db4f61bc88ef81c6db54be55c
This commit is contained in:
SpiritCroc 2021-11-05 08:38:45 +01:00
parent 30cd55d260
commit 4cd19ed7e8

View file

@ -146,16 +146,19 @@ internal class RoomSummaryUpdater @Inject constructor(
}
roomSummaryEntity.hasUnreadMessages = roomSummaryEntity.notificationCount > 0 ||
(roomSummaryEntity.unreadCount?.let { it > 0 } ?: false) ||
// avoid this call if we are sure there are unread events
!isEventRead(realm.configuration, userId, roomId, latestPreviewableEvent?.eventId)
roomSummaryEntity.hasUnreadContentMessages = roomSummaryEntity.notificationCount > 0 ||
(roomSummaryEntity.unreadCount?.let { it > 0 } ?: false) ||
// avoid this call if we are sure there are unread events
(latestPreviewableContentEvent != null &&
!isEventRead(realm.configuration, userId, roomId, latestPreviewableContentEvent.eventId))
roomSummaryEntity.hasUnreadOriginalContentMessages = roomSummaryEntity.notificationCount > 0 ||
(roomSummaryEntity.unreadCount?.let { it > 0 } ?: false) ||
// avoid this call if we are sure there are unread events
(latestPreviewableOriginalContentEvent != null &&
!isEventRead(realm.configuration, userId, roomId, latestPreviewableOriginalContentEvent.eventId))
!isEventRead(realm.configuration, userId, roomId, latestPreviewableOriginalContentEvent.eventId))
roomSummaryEntity.displayName = roomDisplayNameResolver.resolve(realm, roomId)
roomSummaryEntity.avatarUrl = roomAvatarResolver.resolve(realm, roomId)