Merge pull request #8471 from vector-im/bugfix/cjs/poll-finish-contents

Show correct details when a poll is ended.
This commit is contained in:
Benoit Marty 2023-06-09 14:28:07 +02:00 committed by GitHub
commit 48df1136ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

1
changelog.d/8471.bugfix Normal file
View File

@ -0,0 +1 @@
The correct title and options are now displayed When a poll that was edited is ended.

View File

@ -286,7 +286,10 @@ class MessageItemFactory @Inject constructor(
} else { } else {
null null
} }
val pollContent = pollStartEvent?.root?.getClearContent()?.toModel<MessagePollContent>()
val editedContent = pollStartEvent?.annotations?.editSummary?.latestEdit?.getClearContent()?.toModel<MessagePollContent>()?.newContent
val latestContent = editedContent ?: pollStartEvent?.root?.getClearContent()
val pollContent = latestContent?.toModel<MessagePollContent>()
return if (pollContent == null) { return if (pollContent == null) {
val title = stringProvider.getString(R.string.message_reply_to_ended_poll_preview).toEpoxyCharSequence() val title = stringProvider.getString(R.string.message_reply_to_ended_poll_preview).toEpoxyCharSequence()