events: Pass RoomVersionId by reference in redact method
This commit is contained in:
parent
c648f83cb6
commit
698087337b
@ -187,7 +187,7 @@ pub fn expand_event_content(
|
|||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl #ident {
|
impl #ident {
|
||||||
/// Transforms the full event content into a redacted content according to spec.
|
/// Transforms the full event content into a redacted content according to spec.
|
||||||
pub fn redact(self, version: #ruma_identifiers::RoomVersionId) -> #redacted_ident {
|
pub fn redact(self, version: &#ruma_identifiers::RoomVersionId) -> #redacted_ident {
|
||||||
#redacted_ident {
|
#redacted_ident {
|
||||||
#( #redaction_struct_fields: self.#redaction_struct_fields, )*
|
#( #redaction_struct_fields: self.#redaction_struct_fields, )*
|
||||||
}
|
}
|
||||||
|
@ -494,7 +494,7 @@ fn expand_redact(
|
|||||||
pub fn redact(
|
pub fn redact(
|
||||||
self,
|
self,
|
||||||
redaction: #redaction_type,
|
redaction: #redaction_type,
|
||||||
version: #ruma_identifiers::RoomVersionId,
|
version: &#ruma_identifiers::RoomVersionId,
|
||||||
) -> #redacted_enum {
|
) -> #redacted_enum {
|
||||||
match self {
|
match self {
|
||||||
#(
|
#(
|
||||||
|
@ -26,7 +26,7 @@ pub struct CustomEventContent {
|
|||||||
|
|
||||||
impl CustomEventContent {
|
impl CustomEventContent {
|
||||||
/// Transforms the full event content into a redacted content according to spec.
|
/// Transforms the full event content into a redacted content according to spec.
|
||||||
pub fn redact(self, _: RoomVersionId) -> RedactedCustomEventContent {
|
pub fn redact(self, _: &RoomVersionId) -> RedactedCustomEventContent {
|
||||||
RedactedCustomEventContent { event_type: self.event_type }
|
RedactedCustomEventContent { event_type: self.event_type }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ impl AliasesEventContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Redact an `AliasesEventContent` according to current Matrix spec.
|
/// Redact an `AliasesEventContent` according to current Matrix spec.
|
||||||
pub fn redact(self, version: RoomVersionId) -> RedactedAliasesEventContent {
|
pub fn redact(self, version: &RoomVersionId) -> RedactedAliasesEventContent {
|
||||||
// We compare the long way to avoid pre version 6 behavior if/when
|
// We compare the long way to avoid pre version 6 behavior if/when
|
||||||
// a new room version is introduced.
|
// a new room version is introduced.
|
||||||
let aliases = match version {
|
let aliases = match version {
|
||||||
|
@ -346,7 +346,7 @@ fn redact_method_properly_redacts() {
|
|||||||
let event = from_json_value::<Raw<AnyMessageEvent>>(ev).unwrap().deserialize().unwrap();
|
let event = from_json_value::<Raw<AnyMessageEvent>>(ev).unwrap().deserialize().unwrap();
|
||||||
|
|
||||||
assert_matches!(
|
assert_matches!(
|
||||||
event.redact(redaction, RoomVersionId::Version6),
|
event.redact(redaction, &RoomVersionId::Version6),
|
||||||
AnyRedactedMessageEvent::RoomMessage(RedactedMessageEvent {
|
AnyRedactedMessageEvent::RoomMessage(RedactedMessageEvent {
|
||||||
content: RedactedMessageEventContent,
|
content: RedactedMessageEventContent,
|
||||||
event_id,
|
event_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user