diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/NotificationMapper.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/NotificationMapper.kt index bad622e456..7e06eb3c75 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/NotificationMapper.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/NotificationMapper.kt @@ -39,6 +39,7 @@ class NotificationMapper( isDirect = item.roomInfo.isDirect, activeMembersCount = item.roomInfo.joinedMembersCount.toInt(), ) + val timestamp = item.timestamp() ?: clock.epochMillis() NotificationData( sessionId = sessionId, eventId = eventId, @@ -53,8 +54,8 @@ class NotificationMapper( isDm = isDm, isEncrypted = item.roomInfo.isEncrypted.orFalse(), isNoisy = item.isNoisy.orFalse(), - timestamp = item.timestamp() ?: clock.epochMillis(), - content = item.event.use { notificationContentMapper.map(it) }.getOrThrow(), + timestamp = timestamp, + content = notificationContentMapper.map(item.event).getOrThrow(), hasMention = item.hasMention.orFalse(), ) } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt index 2ca4a3c823..b2952461df 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt @@ -25,8 +25,9 @@ class TimelineEventToNotificationContentMapper { fun map(timelineEvent: TimelineEvent): Result { return runCatchingExceptions { timelineEvent.use { + val senderId = UserId(timelineEvent.senderId()) timelineEvent.eventType().use { eventType -> - eventType.toContent(senderId = UserId(timelineEvent.senderId())) + eventType.toContent(senderId = senderId) } } }