Apply the same fix for emotes, notices and other message type.
This commit is contained in:
parent
0483832434
commit
7f867f2f68
1 changed files with 11 additions and 8 deletions
|
|
@ -69,12 +69,15 @@ class TimelineItemContentMessageFactory @Inject constructor(
|
||||||
|
|
||||||
suspend fun create(content: MessageContent, senderDisplayName: String, eventId: EventId?): TimelineItemEventContent {
|
suspend fun create(content: MessageContent, senderDisplayName: String, eventId: EventId?): TimelineItemEventContent {
|
||||||
return when (val messageType = content.type) {
|
return when (val messageType = content.type) {
|
||||||
is EmoteMessageType -> TimelineItemEmoteContent(
|
is EmoteMessageType -> {
|
||||||
body = "* $senderDisplayName ${messageType.body}",
|
val emoteBody = "* $senderDisplayName ${messageType.body}"
|
||||||
htmlDocument = messageType.formatted?.toHtmlDocument(prefix = "* $senderDisplayName"),
|
TimelineItemEmoteContent(
|
||||||
formattedBody = parseHtml(messageType.formatted, prefix = "* $senderDisplayName"),
|
body = emoteBody,
|
||||||
isEdited = content.isEdited,
|
htmlDocument = messageType.formatted?.toHtmlDocument(prefix = "* $senderDisplayName"),
|
||||||
)
|
formattedBody = parseHtml(messageType.formatted, prefix = "* $senderDisplayName") ?: emoteBody.withLinks(),
|
||||||
|
isEdited = content.isEdited,
|
||||||
|
)
|
||||||
|
}
|
||||||
is ImageMessageType -> {
|
is ImageMessageType -> {
|
||||||
val aspectRatio = aspectRatioOf(messageType.info?.width, messageType.info?.height)
|
val aspectRatio = aspectRatioOf(messageType.info?.width, messageType.info?.height)
|
||||||
TimelineItemImageContent(
|
TimelineItemImageContent(
|
||||||
|
|
@ -172,7 +175,7 @@ class TimelineItemContentMessageFactory @Inject constructor(
|
||||||
is NoticeMessageType -> TimelineItemNoticeContent(
|
is NoticeMessageType -> TimelineItemNoticeContent(
|
||||||
body = messageType.body,
|
body = messageType.body,
|
||||||
htmlDocument = messageType.formatted?.toHtmlDocument(),
|
htmlDocument = messageType.formatted?.toHtmlDocument(),
|
||||||
formattedBody = parseHtml(messageType.formatted),
|
formattedBody = parseHtml(messageType.formatted) ?: messageType.body.withLinks(),
|
||||||
isEdited = content.isEdited,
|
isEdited = content.isEdited,
|
||||||
)
|
)
|
||||||
is TextMessageType -> {
|
is TextMessageType -> {
|
||||||
|
|
@ -186,7 +189,7 @@ class TimelineItemContentMessageFactory @Inject constructor(
|
||||||
is OtherMessageType -> TimelineItemTextContent(
|
is OtherMessageType -> TimelineItemTextContent(
|
||||||
body = messageType.body,
|
body = messageType.body,
|
||||||
htmlDocument = null,
|
htmlDocument = null,
|
||||||
formattedBody = null,
|
formattedBody = messageType.body.withLinks(),
|
||||||
isEdited = content.isEdited,
|
isEdited = content.isEdited,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue