Fix prevContent for room.member events

This commit is contained in:
ganfra 2018-11-07 23:11:24 +01:00
parent be8b1287c7
commit 7b6092cee1
2 changed files with 4 additions and 2 deletions

View File

@ -7,5 +7,6 @@ import com.squareup.moshi.JsonClass
data class UnsignedData(
@Json(name = "age") val age: Long?,
@Json(name = "redacted_because") val redactedEvent: Event? = null,
@Json(name = "transaction_id") val transactionId: String? = null
@Json(name = "transaction_id") val transactionId: String? = null,
@Json(name = "prev_content") val prevContent: Map<String, Any>? = null
)

View File

@ -17,7 +17,8 @@ object EventMapper {
val eventEntity = EventEntity()
eventEntity.eventId = event.eventId ?: ""
eventEntity.content = adapter.toJson(event.content)
eventEntity.prevContent = adapter.toJson(event.prevContent)
val resolvedPrevContent = event.prevContent ?: event.unsignedData?.prevContent
eventEntity.prevContent = adapter.toJson(resolvedPrevContent)
eventEntity.stateKey = event.stateKey
eventEntity.type = event.type
eventEntity.sender = event.sender