mirror of
https://github.com/element-hq/element-android
synced 2024-11-26 19:35:42 +03:00
Fix rendering edited poll in timeline.
This commit is contained in:
parent
61f7f12d7f
commit
62e0c80a06
1 changed files with 6 additions and 2 deletions
|
@ -148,8 +148,8 @@ fun TimelineEvent.getLastMessageContent(): MessageContent? {
|
|||
// Polls/Beacon are not message contents like others as there is no msgtype subtype to discriminate moshi parsing
|
||||
// so toModel<MessageContent> won't parse them correctly
|
||||
// It's discriminated on event type instead. Maybe it shouldn't be MessageContent at all to avoid confusion?
|
||||
in EventType.POLL_START.values -> (getLastEditNewContent() ?: root.getClearContent()).toModel<MessagePollContent>()
|
||||
in EventType.POLL_END.values -> (getLastEditNewContent() ?: root.getClearContent()).toModel<MessageEndPollContent>()
|
||||
in EventType.POLL_START.values -> (getLastPollEditNewContent() ?: root.getClearContent()).toModel<MessagePollContent>()
|
||||
in EventType.POLL_END.values -> (getLastPollEditNewContent() ?: root.getClearContent()).toModel<MessageEndPollContent>()
|
||||
in EventType.STATE_ROOM_BEACON_INFO.values -> (getLastEditNewContent() ?: root.getClearContent()).toModel<MessageBeaconInfoContent>()
|
||||
in EventType.BEACON_LOCATION_DATA.values -> (getLastEditNewContent() ?: root.getClearContent()).toModel<MessageBeaconLocationDataContent>()
|
||||
else -> (getLastEditNewContent() ?: root.getClearContent()).toModel()
|
||||
|
@ -160,6 +160,10 @@ fun TimelineEvent.getLastEditNewContent(): Content? {
|
|||
return annotations?.editSummary?.latestEdit?.getClearContent()?.toModel<MessageContent>()?.newContent
|
||||
}
|
||||
|
||||
private fun TimelineEvent.getLastPollEditNewContent(): Content? {
|
||||
return annotations?.editSummary?.latestEdit?.getClearContent()?.toModel<MessagePollContent>()?.newContent
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if it's a reply.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue