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
This commit is contained in:
SpiritCroc 2021-10-06 09:04:48 +02:00
parent 0d6eda56f5
commit 8c4ef3d9cf
1 changed files with 8 additions and 6 deletions

View File

@ -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