From 8c4ef3d9cf8fe264a5ced9df8f0198f44b0d64ab Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Wed, 6 Oct 2021 09:04:48 +0200 Subject: [PATCH] Space unread counts: exclude hidden rooms This fixes old rooms which have been upgraded to a new room version persisting in the unread counter. Change-Id: Ia4eb6fd1b181962ea62d1e996ef18f1bd651a9cd --- .../session/room/summary/RoomSummaryUpdater.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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 9404659ee1..cbb513c85c 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 @@ -451,12 +451,14 @@ internal class RoomSummaryUpdater @Inject constructor( //.equalTo(RoomSummaryEntityFields.IS_DIRECT, false) .contains(RoomSummaryEntityFields.FLATTEN_PARENT_IDS, space.roomId) .findAll().forEach { - highlightCount += it.highlightCount - notificationCount += it.notificationCount - unreadCount += it.safeUnreadCount() - aggregateNotificationCount += min(it.notificationCount, 1) - aggregateUnreadCount += min(it.safeUnreadCount(), 1) - markedUnreadCount += if (it.markedUnread) 1 else 0 + if (!it.isHiddenFromUser) { + highlightCount += it.highlightCount + notificationCount += it.notificationCount + unreadCount += it.safeUnreadCount() + aggregateNotificationCount += min(it.notificationCount, 1) + aggregateUnreadCount += min(it.safeUnreadCount(), 1) + markedUnreadCount += if (it.markedUnread) 1 else 0 + } } space.highlightCount = highlightCount