Do not clear unread counts when fetching room members

This messes with our "open without reading" functionality.

Change-Id: Ie1bf84aa79b3bc0c18efd7325f817aa227b8e748
This commit is contained in:
SpiritCroc 2022-03-31 08:37:40 +02:00
parent 128b532b51
commit f50b21d9b7
2 changed files with 10 additions and 7 deletions

View File

@ -126,7 +126,7 @@ internal class DefaultLoadRoomMembersTask @Inject constructor(
roomMemberEventHandler.handle(realm, roomId, roomMemberEvent)
}
roomEntity.membersLoadStatus = RoomMembersLoadStatusType.LOADED
roomSummaryUpdater.update(realm, roomId, updateMembers = true)
roomSummaryUpdater.update(realm, roomId, updateMembers = true, updateCounts = false)
}
if (cryptoSessionInfoProvider.isRoomEncrypted(roomId)) {

View File

@ -87,7 +87,8 @@ internal class RoomSummaryUpdater @Inject constructor(
unreadNotifications: RoomSyncUnreadNotifications? = null,
unreadCount: Int? = null,
updateMembers: Boolean = false,
inviterId: String? = null) {
inviterId: String? = null,
updateCounts: Boolean = true) {
val roomSummaryEntity = RoomSummaryEntity.getOrCreate(realm, roomId)
if (roomSummary != null) {
if (roomSummary.heroes.isNotEmpty()) {
@ -101,11 +102,13 @@ internal class RoomSummaryUpdater @Inject constructor(
roomSummaryEntity.joinedMembersCount = roomSummary.joinedMembersCount
}
}
roomSummaryEntity.highlightCount = unreadNotifications?.highlightCount ?: 0
roomSummaryEntity.notificationCount = unreadNotifications?.notificationCount ?: 0
roomSummaryEntity.unreadCount = unreadCount
roomSummaryEntity.aggregatedNotificationCount = roomSummaryEntity.notificationCount
roomSummaryEntity.aggregatedUnreadCount = roomSummaryEntity.safeUnreadCount()
if (updateCounts) {
roomSummaryEntity.highlightCount = unreadNotifications?.highlightCount ?: 0
roomSummaryEntity.notificationCount = unreadNotifications?.notificationCount ?: 0
roomSummaryEntity.unreadCount = unreadCount
roomSummaryEntity.aggregatedNotificationCount = roomSummaryEntity.notificationCount
roomSummaryEntity.aggregatedUnreadCount = roomSummaryEntity.safeUnreadCount()
}
if (membership != null) {
roomSummaryEntity.membership = membership