diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/LoadRoomMembersTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/LoadRoomMembersTask.kt index 3d0f51b831..15e804d69e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/LoadRoomMembersTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/LoadRoomMembersTask.kt @@ -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)) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt index 4b8cef3691..7cf98549eb 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt @@ -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