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