mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-19 06:04:31 -04:00
feat(event cache): handle redacted redactions in the AllEventsCache
This is unlikely that it will affect us, so not worth adding a test IMO, but for the sake of completeness: this handles redacted redactions in the `AllEventsCache` too.
This commit is contained in:
@@ -381,13 +381,23 @@ impl AllEventsCache {
|
||||
};
|
||||
|
||||
// Handle redactions separately, as their logic is slightly different.
|
||||
if let AnySyncMessageLikeEvent::RoomRedaction(SyncRoomRedactionEvent::Original(ev)) = &ev {
|
||||
if let Some(redacted_event_id) = ev.content.redacts.as_ref().or(ev.redacts.as_ref()) {
|
||||
if let AnySyncMessageLikeEvent::RoomRedaction(room_redaction) = &ev {
|
||||
let redacted_event_id = match room_redaction {
|
||||
SyncRoomRedactionEvent::Original(ev) => {
|
||||
ev.content.redacts.as_ref().or(ev.redacts.as_ref())
|
||||
}
|
||||
SyncRoomRedactionEvent::Redacted(redacted_redaction) => {
|
||||
redacted_redaction.content.redacts.as_ref()
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(redacted_event_id) = redacted_event_id {
|
||||
self.relations
|
||||
.entry(redacted_event_id.to_owned())
|
||||
.or_default()
|
||||
.insert(ev.event_id.to_owned(), RelationType::Replacement);
|
||||
.insert(ev.event_id().to_owned(), RelationType::Replacement);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user