Skip to content

Commit

Permalink
Always consider client-side mention counts
Browse files Browse the repository at this point in the history
The server does not know mention counts in encrypted rooms

Change-Id: I771fc105ece1255ba5573da5650956922cacbb21
  • Loading branch information
SpiritCroc committed Mar 21, 2024
1 parent 2e1162c commit 669036c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import io.element.android.libraries.matrix.impl.room.member.RoomMemberMapper
import io.element.android.libraries.matrix.impl.room.message.RoomMessageFactory
import org.matrix.rustcomponents.sdk.RoomInfo
import org.matrix.rustcomponents.sdk.use
import kotlin.math.max

class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFactory = RoomMessageFactory()) {
fun create(roomInfo: RoomInfo): RoomSummaryDetails {
Expand All @@ -41,7 +42,7 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
numUnreadMessages = roomInfo.numUnreadMessages.toInt(),
numUnreadNotifications = roomInfo.numUnreadNotifications.toInt(),
unreadNotificationCount = roomInfo.notificationCount.toInt(),
highlightCount = roomInfo.highlightCount.toInt(),
highlightCount = max(roomInfo.highlightCount.toInt(), roomInfo.numUnreadMentions.toInt()), // Encrypted rooms don't know mentions server-side, so check both values
unreadCount = roomInfo.unreadCount.toInt(),
isLowPriority = roomInfo.isLowPriority,
isMarkedUnread = roomInfo.isMarkedUnread,
Expand Down

0 comments on commit 669036c

Please sign in to comment.