mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-04 14:04:40 -04:00
sdk: Fix redaction regression
This commit is contained in:
committed by
Jonas Platte
parent
749b57f30a
commit
443e729f5b
@@ -537,11 +537,15 @@ impl<'a> TimelineEventHandler<'a> {
|
||||
// directly with the raw event timeline feature (not yet implemented).
|
||||
update_timeline_item!(self, &redacts, "redaction", |event_item| {
|
||||
let Some(remote_event_item) = event_item.as_remote() else {
|
||||
error!("inconsistent state: reaction received on a non-remote event item");
|
||||
error!("inconsistent state: redaction received on a non-remote event item");
|
||||
return None;
|
||||
};
|
||||
|
||||
Some(event_item.with_kind(remote_event_item.to_redacted()))
|
||||
let mut event_item = event_item.to_owned();
|
||||
event_item.content = TimelineItemContent::RedactedMessage;
|
||||
event_item.kind = remote_event_item.without_reactions().into();
|
||||
|
||||
Some(event_item)
|
||||
});
|
||||
|
||||
if self.result.items_updated == 0 {
|
||||
|
||||
@@ -58,9 +58,8 @@ impl RemoteEventTimelineItem {
|
||||
Self { reactions, ..self.clone() }
|
||||
}
|
||||
|
||||
/// Clone the current event item, change its `content` to
|
||||
/// [`TimelineItemContent::RedactedMessage`], and reset its `reactions`.
|
||||
pub fn to_redacted(&self) -> Self {
|
||||
/// Clone the current event item, and reset its `reactions`.
|
||||
pub fn without_reactions(&self) -> Self {
|
||||
Self { reactions: BundledReactions::default(), ..self.clone() }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user