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 issue when opening encrypted files (#3186)
- Fix wording issue (#3242)
- Fix missing sender information after edits (#3184)
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.RelationType
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.toModel
import org.matrix.android.sdk.api.session.room.model.EventAnnotationsSummary
@ -151,6 +152,10 @@ fun TimelineEvent.isReply(): Boolean {
return root.isReply()
}
fun TimelineEvent.isEdition(): Boolean {
return root.isEdition()
}
fun TimelineEvent.getTextEditableContent(): String? {
val lastContent = getLastMessageContent()
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.getLastMessageContent
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 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)
|| isNextMessageReceivedMoreThanOneHourAgo
|| isTileTypeMessage(nextEvent)
|| nextEvent.isEdition()
val time = dateFormatter.format(event.root.originServerTs, DateFormatKind.MESSAGE_SIMPLE)
val e2eDecoration = getE2EDecoration(event)