FastLane: Ignore message edition

This commit is contained in:
Benoit Marty 2021-03-25 14:42:15 +01:00 committed by Benoit Marty
parent 7f7f90f89e
commit 4a0a6e9f01
2 changed files with 8 additions and 1 deletions

View file

@ -289,3 +289,7 @@ fun Event.getRelationContent(): RelationDefaultContent? {
fun Event.isReply(): Boolean {
return getRelationContent()?.inReplyTo?.eventId != null
}
fun Event.isEdition(): Boolean {
return getRelationContent()?.takeIf { it.type == RelationType.REPLACE }?.eventId != null
}

View file

@ -26,6 +26,7 @@ import org.matrix.android.sdk.api.session.content.ContentUrlResolver
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
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.isEdition
import org.matrix.android.sdk.api.session.events.model.toModel
import org.matrix.android.sdk.api.session.room.model.Membership
import org.matrix.android.sdk.api.session.room.model.RoomMemberContent
@ -89,7 +90,9 @@ class NotifiableEventResolver @Inject constructor(
fun resolveInMemoryEvent(session: Session, event: Event): NotifiableEvent? {
if (event.getClearType() != EventType.MESSAGE) return null
// TODO Ignore message edition
// Ignore message edition
if (event.isEdition()) return null
val user = session.getUser(event.senderId!!) ?: return null
val timelineEvent = TimelineEvent(