events: Add FullStateEventContent::redact
This commit is contained in:
parent
2ccc0323f6
commit
1229fa4461
@ -22,6 +22,7 @@ Improvements:
|
||||
- `PushCondition::EventMatch` and `FlattenedJson` now use escaped dotted paths, according to MSC3873
|
||||
- Add unstable support for `event_property_is` push condition according to MSC3758
|
||||
- Add unstable support for `event_property_contains` push condition according to MSC3966
|
||||
- Add `FullStateEventContent::redact`
|
||||
|
||||
# 0.11.3
|
||||
|
||||
|
@ -14,7 +14,8 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
serde::{from_raw_json_value, Raw},
|
||||
EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId, OwnedUserId, RoomId, UserId,
|
||||
EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId, OwnedUserId, RoomId,
|
||||
RoomVersionId, UserId,
|
||||
};
|
||||
|
||||
/// A global account data event.
|
||||
@ -553,6 +554,19 @@ where
|
||||
Self::Redacted(content) => content.event_type(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Transform `self` into a redacted form (removing most or all fields) according to the spec.
|
||||
///
|
||||
/// If `self` is already [`Redacted`](Self::Redacted), return the inner data unmodified.
|
||||
///
|
||||
/// A small number of events have room-version specific redaction behavior, so a version has to
|
||||
/// be specified.
|
||||
pub fn redact(self, version: &RoomVersionId) -> C::Redacted {
|
||||
match self {
|
||||
FullStateEventContent::Original { content, .. } => content.redact(version),
|
||||
FullStateEventContent::Redacted(content) => content,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_possibly_redacted_event {
|
||||
|
Loading…
x
Reference in New Issue
Block a user