forked from GitHub-Mirror/riotX-android
Handle redacted e2e event
This commit is contained in:
parent
3f74c4e933
commit
8e76700c8d
@ -228,4 +228,8 @@ data class Event(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if the event is redacted
|
||||
*/
|
||||
fun isRedacted() = unsignedData?.redactedEvent != null
|
||||
}
|
@ -107,7 +107,7 @@ internal class InMemoryTimelineEventFactory @Inject constructor(private val room
|
||||
senderRoomMember?.avatarUrl)
|
||||
}
|
||||
val event = eventEntity.asDomain()
|
||||
if (event.getClearType() == EventType.ENCRYPTED) {
|
||||
if (event.getClearType() == EventType.ENCRYPTED && !event.isRedacted()) {
|
||||
handleEncryptedEvent(event, eventEntity.localId)
|
||||
}
|
||||
|
||||
@ -141,6 +141,9 @@ internal class InMemoryTimelineEventFactory @Inject constructor(private val room
|
||||
Timber.e(failure, "Encrypted event: decryption failed")
|
||||
if (failure is MXDecryptionException) {
|
||||
event.setCryptoError(failure.cryptoError)
|
||||
} else {
|
||||
// Other error
|
||||
Timber.e("Other error, should be handled")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class MessageItemFactory @Inject constructor(
|
||||
|
||||
val informationData = messageInformationDataFactory.create(event, nextEvent)
|
||||
|
||||
if (event.root.unsignedData?.redactedEvent != null) {
|
||||
if (event.root.isRedacted()) {
|
||||
//message is redacted
|
||||
return buildRedactedItem(informationData, highlight, callback)
|
||||
}
|
||||
|
@ -55,7 +55,14 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
|
||||
|
||||
// Crypto
|
||||
EventType.ENCRYPTION -> encryptionItemFactory.create(event, highlight, callback)
|
||||
EventType.ENCRYPTED -> encryptedItemFactory.create(event, nextEvent, highlight, callback)
|
||||
EventType.ENCRYPTED -> {
|
||||
if (event.root.isRedacted()) {
|
||||
// Redacted event, let the MessageItemFactory handle it
|
||||
messageItemFactory.create(event, nextEvent, highlight, callback)
|
||||
} else {
|
||||
encryptedItemFactory.create(event, nextEvent, highlight, callback)
|
||||
}
|
||||
}
|
||||
|
||||
// Unhandled event types (yet)
|
||||
EventType.STATE_ROOM_THIRD_PARTY_INVITE,
|
||||
|
Loading…
Reference in New Issue
Block a user