Timeline hot fix: when room member is null, use sender to render name. Still have to figure it out why RoomMember can be null.

This commit is contained in:
ganfra 2019-01-18 19:40:20 +01:00
parent 2380499af2
commit c7c3a57c93

View File

@ -21,7 +21,7 @@ class MessageItemFactory(private val timelineDateFormatter: TimelineDateFormatte

val messageContent: MessageContent? = event.root.content.toModel()
val roomMember = event.roomMember
if (messageContent == null || roomMember == null) {
if (messageContent == null) {
return null
}
val nextRoomMember = nextEvent?.roomMember
@ -34,7 +34,7 @@ class MessageItemFactory(private val timelineDateFormatter: TimelineDateFormatte

if (addDaySeparator
|| nextRoomMember != roomMember
|| nextEvent.root.type != EventType.MESSAGE
|| nextEvent?.root?.type != EventType.MESSAGE
|| isNextMessageReceivedMoreThanOneHourAgo) {
messagesDisplayedWithInformation.add(event.root.eventId)
}
@ -52,10 +52,10 @@ class MessageItemFactory(private val timelineDateFormatter: TimelineDateFormatte
val showInformation = messagesDisplayedWithInformation.contains(event.root.eventId)
return MessageItem(
message = message,
avatarUrl = roomMember.avatarUrl,
avatarUrl = roomMember?.avatarUrl,
showInformation = showInformation,
time = timelineDateFormatter.formatMessageHour(date),
memberName = roomMember.displayName ?: event.root.sender
memberName = roomMember?.displayName ?: event.root.sender
)
}