diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/TimelineUseCase.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/TimelineUseCase.kt index 3b51d29..f47dcc2 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/TimelineUseCase.kt +++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/TimelineUseCase.kt @@ -29,15 +29,13 @@ internal class TimelineUseCaseImpl( MessengerState( roomState = when { localEchos.isEmpty() -> roomState - else -> mergeWithLocalEchosUseCase.invoke( - roomState, - roomService.findMember(roomId, userId) ?: RoomMember( - userId, - null, - avatarUrl = null, - ), - localEchos, - ) + else -> { + mergeWithLocalEchosUseCase.invoke( + roomState, + roomService.findMember(roomId, userId) ?: userId.toFallbackMember(), + localEchos, + ) + } }, typing = events.filterIsInstance().firstOrNull { it.roomId == roomId }, self = userId, @@ -47,6 +45,8 @@ internal class TimelineUseCaseImpl( } +private fun UserId.toFallbackMember() = RoomMember(this, displayName = null, avatarUrl = null) + data class MessengerState( val self: UserId, val roomState: RoomState, diff --git a/matrix/services/message/src/main/kotlin/app/dapk/st/matrix/message/MessageService.kt b/matrix/services/message/src/main/kotlin/app/dapk/st/matrix/message/MessageService.kt index 1f8860d..6103470 100644 --- a/matrix/services/message/src/main/kotlin/app/dapk/st/matrix/message/MessageService.kt +++ b/matrix/services/message/src/main/kotlin/app/dapk/st/matrix/message/MessageService.kt @@ -12,7 +12,7 @@ import app.dapk.st.matrix.message.internal.DefaultMessageService import kotlinx.coroutines.flow.Flow import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import java.util.* +import kotlinx.serialization.Transient private val SERVICE_KEY = MessageService::class