mirror of
https://github.com/ouchadam/small-talk.git
synced 2025-01-03 13:29:18 +01:00
fixing missing nested replies/images
This commit is contained in:
parent
83c18a3715
commit
c2c6296e9a
@ -65,17 +65,13 @@ internal class TimelineEventMapper(
|
||||
|
||||
private suspend fun ApiTimelineEvent.TimelineMessage.handleReply(replyToId: EventId, lookup: Lookup): RoomEvent {
|
||||
val relationEvent = lookup(replyToId).fold(
|
||||
onApiTimelineEvent = { it.toTextMessage() },
|
||||
onApiTimelineEvent = { it.toMessage() },
|
||||
onRoomEvent = { it },
|
||||
onEmpty = { null }
|
||||
)
|
||||
|
||||
return when (relationEvent) {
|
||||
null -> when (this.content) {
|
||||
is ApiTimelineEvent.TimelineMessage.Content.Image -> this.toImageMessage()
|
||||
is ApiTimelineEvent.TimelineMessage.Content.Text -> this.toFallbackTextMessage()
|
||||
ApiTimelineEvent.TimelineMessage.Content.Ignored -> throw IllegalStateException()
|
||||
}
|
||||
null -> this.toMessage()
|
||||
else -> {
|
||||
RoomEvent.Reply(
|
||||
message = roomEventFactory.mapToRoomEvent(this),
|
||||
@ -89,6 +85,12 @@ internal class TimelineEventMapper(
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun ApiTimelineEvent.TimelineMessage.toMessage() = when (this.content) {
|
||||
is ApiTimelineEvent.TimelineMessage.Content.Image -> this.toImageMessage()
|
||||
is ApiTimelineEvent.TimelineMessage.Content.Text -> this.toFallbackTextMessage()
|
||||
ApiTimelineEvent.TimelineMessage.Content.Ignored -> throw IllegalStateException()
|
||||
}
|
||||
|
||||
private suspend fun ApiTimelineEvent.TimelineMessage.toFallbackTextMessage() = this.toTextMessage(content = this.asTextContent().body ?: "redacted")
|
||||
|
||||
private suspend fun ApiTimelineEvent.TimelineMessage.handleEdit(editedEventId: EventId, lookup: Lookup): RoomEvent? {
|
||||
|
Loading…
Reference in New Issue
Block a user