mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Add changelog, some cleaning
This commit is contained in:
parent
891709ef41
commit
e66a0541be
1
changelog.d/7594.misc
Normal file
1
changelog.d/7594.misc
Normal file
@ -0,0 +1 @@
|
||||
Better validation of edits
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 New Vector Ltd
|
||||
* Copyright (c) 2022 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -33,13 +33,15 @@ internal class EventEditValidator @Inject constructor(val cryptoStore: IMXCrypto
|
||||
}
|
||||
|
||||
/**
|
||||
*There are a number of requirements on replacement events, which must be satisfied for the replacement to be considered valid:
|
||||
* There are a number of requirements on replacement events, which must be satisfied for the replacement
|
||||
* to be considered valid:
|
||||
* As with all event relationships, the original event and replacement event must have the same room_id
|
||||
* (i.e. you cannot send an event in one room and then an edited version in a different room).
|
||||
* The original event and replacement event must have the same sender (i.e. you cannot edit someone else’s messages).
|
||||
* The replacement and original events must have the same type (i.e. you cannot change the original event’s type).
|
||||
* The replacement and original events must not have a state_key property (i.e. you cannot edit state events at all).
|
||||
* The original event must not, itself, have a rel_type of m.replace (i.e. you cannot edit an edit — though you can send multiple edits for a single original event).
|
||||
* The original event must not, itself, have a rel_type of m.replace
|
||||
* (i.e. you cannot edit an edit — though you can send multiple edits for a single original event).
|
||||
* The replacement event (once decrypted, if appropriate) must have an m.new_content property.
|
||||
*
|
||||
* If the original event was encrypted, the replacement should be too.
|
||||
|
@ -213,7 +213,7 @@ internal class EventRelationsAggregationProcessor @Inject constructor(
|
||||
if (content?.relatesTo?.type == RelationType.REPLACE) {
|
||||
Timber.v("###REPLACE in room $roomId for event ${event.eventId}")
|
||||
// A replace!
|
||||
handleReplace(realm, event, roomId, isLocalEcho, content?.relatesTo.eventId)
|
||||
handleReplace(realm, event, roomId, isLocalEcho, content.relatesTo.eventId)
|
||||
}
|
||||
}
|
||||
in EventType.POLL_RESPONSE -> {
|
||||
@ -474,7 +474,7 @@ internal class EventRelationsAggregationProcessor @Inject constructor(
|
||||
}
|
||||
val sourceToDiscard = eventSummary.editSummary?.editions?.firstOrNull { it.eventId == redacted.eventId }
|
||||
if (sourceToDiscard == null) {
|
||||
Timber.w("Redaction of a replace that was not known in aggregation $sourceToDiscard")
|
||||
Timber.w("Redaction of a replace that was not known in aggregation")
|
||||
return
|
||||
}
|
||||
// Need to remove this event from the edition list
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 New Vector Ltd
|
||||
* Copyright (c) 2022 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
Loading…
Reference in New Issue
Block a user