Adding fallback text on Poll end message

This commit is contained in:
Maxime NATUREL 2023-02-14 17:01:57 +01:00
parent cf609e5fe3
commit 28089618a3
2 changed files with 10 additions and 3 deletions

View file

@ -33,5 +33,11 @@ data class MessageEndPollContent(
override val msgType: String = MessageType.MSGTYPE_POLL_END,
@Json(name = "body") override val body: String = "",
@Json(name = "m.new_content") override val newContent: Content? = null,
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null
) : MessageContent
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
@Json(name = "org.matrix.msc1767.text") val unstableText: String? = null,
@Json(name = "m.text") val text: String? = null,
) : MessageContent {
fun getBestText() = text ?: unstableText
}

View file

@ -242,7 +242,8 @@ internal class LocalEchoEventFactory @Inject constructor(
relatesTo = RelationDefaultContent(
type = RelationType.REFERENCE,
eventId = eventId
)
),
unstableText = "Ended poll",
)
val localId = LocalEcho.createLocalEchoId()
return Event(