Skip to content

Commit 37429c2

Browse files
committed
Show correct details when a poll is ended.
Previously, the "end poll" timeline item always showed the title and options from the start event, regardless of whether any edits had been made. Now we show the latest edit, if available, falling back to the original otherwise.
1 parent 8f69e41 commit 37429c2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

changelog.d/8471.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The correct title and options are now displayed When a poll that was edited is ended.

vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,10 @@ class MessageItemFactory @Inject constructor(
286286
} else {
287287
null
288288
}
289-
val pollContent = pollStartEvent?.root?.getClearContent()?.toModel<MessagePollContent>()
289+
290+
val editedContent = pollStartEvent?.annotations?.editSummary?.latestEdit?.getClearContent()?.toModel<MessagePollContent>()?.newContent
291+
val latestContent = editedContent ?: pollStartEvent?.root?.getClearContent()
292+
val pollContent = latestContent?.toModel<MessagePollContent>()
290293

291294
return if (pollContent == null) {
292295
val title = stringProvider.getString(R.string.message_reply_to_ended_poll_preview).toEpoxyCharSequence()

0 commit comments

Comments
 (0)