events: Use possibly-redacted content for StrippedStateEvent
This commit is contained in:
parent
2eba14f0cc
commit
62ed200a56
@ -6,10 +6,10 @@ use serde_json::value::RawValue as RawJsonValue;
|
||||
|
||||
use super::{
|
||||
EphemeralRoomEventContent, EventContent, EventContentFromType, GlobalAccountDataEventContent,
|
||||
MessageLikeEventContent, MessageLikeEventType, MessageLikeUnsigned, RedactContent,
|
||||
RedactedMessageLikeEventContent, RedactedStateEventContent, RedactedUnsigned,
|
||||
RedactionDeHelper, RoomAccountDataEventContent, StateEventType, StaticStateEventContent,
|
||||
ToDeviceEventContent,
|
||||
MessageLikeEventContent, MessageLikeEventType, MessageLikeUnsigned,
|
||||
PossiblyRedactedStateEventContent, RedactContent, RedactedMessageLikeEventContent,
|
||||
RedactedStateEventContent, RedactedUnsigned, RedactionDeHelper, RoomAccountDataEventContent,
|
||||
StateEventType, StaticStateEventContent, ToDeviceEventContent,
|
||||
};
|
||||
use crate::{
|
||||
serde::from_raw_json_value, EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId,
|
||||
@ -285,7 +285,7 @@ pub struct OriginalSyncStateEvent<C: StaticStateEventContent> {
|
||||
|
||||
/// A stripped-down state event, used for previews of rooms the user has been invited to.
|
||||
#[derive(Clone, Debug, Event)]
|
||||
pub struct StrippedStateEvent<C: StaticStateEventContent> {
|
||||
pub struct StrippedStateEvent<C: PossiblyRedactedStateEventContent> {
|
||||
/// Data specific to the event type.
|
||||
pub content: C,
|
||||
|
||||
|
@ -740,6 +740,8 @@ fn generate_event_type_aliases(
|
||||
|
||||
let content_struct = if var.is_redacted() {
|
||||
Cow::Owned(format_ident!("Redacted{ident}"))
|
||||
} else if let EventKindVariation::Stripped = var {
|
||||
Cow::Owned(format_ident!("PossiblyRedacted{ident}"))
|
||||
} else {
|
||||
Cow::Borrowed(ident)
|
||||
};
|
||||
|
@ -543,6 +543,9 @@ fn expand_accessor_methods(
|
||||
}
|
||||
|
||||
accessors
|
||||
} else if var == EventEnumVariation::Stripped {
|
||||
// There is no content enum for possibly-redacted content types (yet)
|
||||
TokenStream::new()
|
||||
} else {
|
||||
quote! {
|
||||
/// Returns the content for this event.
|
||||
|
Loading…
x
Reference in New Issue
Block a user