Fix missing sender information after edits

Fixes https://github.com/vector-im/element-android/issues/3184
This commit is contained in:
SpiritCroc 2021-05-01 09:29:31 +02:00
parent c4a4a5d41c
commit 47aa787ecb
3 changed files with 8 additions and 0 deletions

View File

@ -16,6 +16,7 @@ Bugfix 🐛:
- Fix issues on Android 11 (#3067) - Fix issues on Android 11 (#3067)
- Fix issue when opening encrypted files (#3186) - Fix issue when opening encrypted files (#3186)
- Fix wording issue (#3242) - Fix wording issue (#3242)
- Fix missing sender information after edits (#3184)
Translations 🗣: Translations 🗣:
- -

View File

@ -21,6 +21,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.events.model.EventType import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.RelationType import org.matrix.android.sdk.api.session.events.model.RelationType
import org.matrix.android.sdk.api.session.events.model.getRelationContent import org.matrix.android.sdk.api.session.events.model.getRelationContent
import org.matrix.android.sdk.api.session.events.model.isEdition
import org.matrix.android.sdk.api.session.events.model.isReply import org.matrix.android.sdk.api.session.events.model.isReply
import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.api.session.events.model.toModel
import org.matrix.android.sdk.api.session.room.model.EventAnnotationsSummary import org.matrix.android.sdk.api.session.room.model.EventAnnotationsSummary
@ -151,6 +152,10 @@ fun TimelineEvent.isReply(): Boolean {
return root.isReply() return root.isReply()
} }
fun TimelineEvent.isEdition(): Boolean {
return root.isEdition()
}
fun TimelineEvent.getTextEditableContent(): String? { fun TimelineEvent.getTextEditableContent(): String? {
val lastContent = getLastMessageContent() val lastContent = getLastMessageContent()
return if (isReply()) { return if (isReply()) {

View File

@ -39,6 +39,7 @@ import org.matrix.android.sdk.api.session.room.send.SendState
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
import org.matrix.android.sdk.api.session.room.timeline.hasBeenEdited import org.matrix.android.sdk.api.session.room.timeline.hasBeenEdited
import org.matrix.android.sdk.api.session.room.timeline.isEdition
import org.matrix.android.sdk.internal.crypto.model.event.EncryptedEventContent import org.matrix.android.sdk.internal.crypto.model.event.EncryptedEventContent
import javax.inject.Inject import javax.inject.Inject
@ -69,6 +70,7 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
|| nextEvent.root.getClearType() !in listOf(EventType.MESSAGE, EventType.STICKER, EventType.ENCRYPTED) || nextEvent.root.getClearType() !in listOf(EventType.MESSAGE, EventType.STICKER, EventType.ENCRYPTED)
|| isNextMessageReceivedMoreThanOneHourAgo || isNextMessageReceivedMoreThanOneHourAgo
|| isTileTypeMessage(nextEvent) || isTileTypeMessage(nextEvent)
|| nextEvent.isEdition()
val time = dateFormatter.format(event.root.originServerTs, DateFormatKind.MESSAGE_SIMPLE) val time = dateFormatter.format(event.root.originServerTs, DateFormatKind.MESSAGE_SIMPLE)
val e2eDecoration = getE2EDecoration(event) val e2eDecoration = getE2EDecoration(event)