From bc5c02c1cb559874dc768a33e6673acd31390082 Mon Sep 17 00:00:00 2001 From: Marco Romano Date: Wed, 22 Nov 2023 16:14:10 +0100 Subject: [PATCH] Show poll question in timeline replies (#1857) Forgot to add this bit to: https://github.com/vector-im/element-x-android/pull/1848 --- .../timeline/components/TimelineItemEventRow.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt index d9a33405592..03b1afdf13f 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt @@ -681,11 +681,14 @@ private fun attachmentThumbnailInfoForInReplyTo(inReplyTo: InReplyTo.Ready): Att @Composable private fun textForInReplyTo(inReplyTo: InReplyTo.Ready): String { - val messageContent = inReplyTo.content as? MessageContent ?: return "" - return when (messageContent.type) { - is LocationMessageType -> stringResource(CommonStrings.common_shared_location) - is VoiceMessageType -> stringResource(CommonStrings.common_voice_message) - else -> messageContent.body + return when (val eventContent = inReplyTo.content) { + is MessageContent -> when (eventContent.type) { + is LocationMessageType -> stringResource(CommonStrings.common_shared_location) + is VoiceMessageType -> stringResource(CommonStrings.common_voice_message) + else -> eventContent.body + } + is PollContent -> eventContent.question + else -> "" } }