diff --git a/crates/ruma-events/src/key/verification/accept.rs b/crates/ruma-events/src/key/verification/accept.rs index a7ff2fb3..26ba31ea 100644 --- a/crates/ruma-events/src/key/verification/accept.rs +++ b/crates/ruma-events/src/key/verification/accept.rs @@ -55,15 +55,15 @@ pub struct AcceptEventContent { /// Information about the related event. #[serde(rename = "m.relates_to")] - pub relation: Relation, + pub relates_to: Relation, } #[cfg(feature = "unstable-pre-spec")] impl AcceptEventContent { /// Creates a new `AcceptToDeviceEventContent` with the given method-specific content and /// relation. - pub fn new(method: AcceptMethod, relation: Relation) -> Self { - Self { method, relation } + pub fn new(method: AcceptMethod, relates_to: Relation) -> Self { + Self { method, relates_to } } } @@ -255,7 +255,7 @@ mod tests { let event_id = event_id!("$1598361704261elfgc:localhost"); let key_verification_accept_content = AcceptEventContent { - relation: Relation { event_id: event_id.clone() }, + relates_to: Relation { event_id: event_id.clone() }, method: AcceptMethod::SasV1(SasV1Content { hash: HashAlgorithm::Sha256, key_agreement_protocol: KeyAgreementProtocol::Curve25519, @@ -417,7 +417,7 @@ mod tests { .deserialize() .unwrap(), AcceptEventContent { - relation: Relation { + relates_to: Relation { event_id }, method: AcceptMethod::SasV1(SasV1Content { diff --git a/crates/ruma-events/src/key/verification/cancel.rs b/crates/ruma-events/src/key/verification/cancel.rs index e6396a32..3a39bfd4 100644 --- a/crates/ruma-events/src/key/verification/cancel.rs +++ b/crates/ruma-events/src/key/verification/cancel.rs @@ -55,14 +55,14 @@ pub struct CancelEventContent { /// Information about the related event. #[serde(rename = "m.relates_to")] - pub relation: Relation, + pub relates_to: Relation, } #[cfg(feature = "unstable-pre-spec")] impl CancelEventContent { /// Creates a new `CancelEventContent` with the given reason, code and relation. - pub fn new(reason: String, code: CancelCode, relation: Relation) -> Self { - Self { reason, code, relation } + pub fn new(reason: String, code: CancelCode, relates_to: Relation) -> Self { + Self { reason, code, relates_to } } } diff --git a/crates/ruma-events/src/key/verification/done.rs b/crates/ruma-events/src/key/verification/done.rs index c4a77b66..72be1e0f 100644 --- a/crates/ruma-events/src/key/verification/done.rs +++ b/crates/ruma-events/src/key/verification/done.rs @@ -35,13 +35,13 @@ impl DoneToDeviceEventContent { pub struct DoneEventContent { /// Relation signaling which verification request this event is responding to. #[serde(rename = "m.relates_to")] - pub relation: Relation, + pub relates_to: Relation, } impl DoneEventContent { - /// Creates a new `DoneEventContent` with the given relation: - pub fn new(relation: Relation) -> Self { - Self { relation } + /// Creates a new `DoneEventContent` with the given relation. + pub fn new(relates_to: Relation) -> Self { + Self { relates_to } } } @@ -66,7 +66,7 @@ mod tests { } }); - let content = DoneEventContent { relation: Relation { event_id } }; + let content = DoneEventContent { relates_to: Relation { event_id } }; assert_eq!(to_json_value(&content).unwrap(), json_data); } @@ -88,7 +88,7 @@ mod tests { .deserialize() .unwrap(), DoneEventContent { - relation: Relation { + relates_to: Relation { event_id }, } if event_id == id diff --git a/crates/ruma-events/src/key/verification/key.rs b/crates/ruma-events/src/key/verification/key.rs index ef7d9e37..58d25a62 100644 --- a/crates/ruma-events/src/key/verification/key.rs +++ b/crates/ruma-events/src/key/verification/key.rs @@ -46,13 +46,13 @@ pub struct KeyEventContent { /// Information about the related event. #[serde(rename = "m.relates_to")] - pub relation: Relation, + pub relates_to: Relation, } #[cfg(feature = "unstable-pre-spec")] impl KeyEventContent { /// Creates a new `KeyEventContent` with the given key and relation. - pub fn new(key: String, relation: Relation) -> Self { - Self { key, relation } + pub fn new(key: String, relates_to: Relation) -> Self { + Self { key, relates_to } } } diff --git a/crates/ruma-events/src/key/verification/mac.rs b/crates/ruma-events/src/key/verification/mac.rs index ce148f11..dbcfa71d 100644 --- a/crates/ruma-events/src/key/verification/mac.rs +++ b/crates/ruma-events/src/key/verification/mac.rs @@ -61,13 +61,13 @@ pub struct MacEventContent { /// Information about the related event. #[serde(rename = "m.relates_to")] - pub relation: Relation, + pub relates_to: Relation, } #[cfg(feature = "unstable-pre-spec")] impl MacEventContent { /// Creates a new `MacEventContent` with the given key ID to MAC map, key MAC and relation. - pub fn new(mac: BTreeMap, keys: String, relation: Relation) -> Self { - Self { mac, keys, relation } + pub fn new(mac: BTreeMap, keys: String, relates_to: Relation) -> Self { + Self { mac, keys, relates_to } } } diff --git a/crates/ruma-events/src/key/verification/ready.rs b/crates/ruma-events/src/key/verification/ready.rs index 96d7faf1..a5e0d142 100644 --- a/crates/ruma-events/src/key/verification/ready.rs +++ b/crates/ruma-events/src/key/verification/ready.rs @@ -55,7 +55,7 @@ pub struct ReadyEventContent { /// Relation signaling which verification request this event is responding /// to. #[serde(rename = "m.relates_to")] - pub relation: Relation, + pub relates_to: Relation, } impl ReadyEventContent { @@ -63,9 +63,9 @@ impl ReadyEventContent { pub fn new( from_device: DeviceIdBox, methods: Vec, - relation: Relation, + relates_to: Relation, ) -> Self { - Self { from_device, methods, relation } + Self { from_device, methods, relates_to } } } @@ -95,7 +95,7 @@ mod tests { let content = ReadyEventContent { from_device: device.clone(), - relation: Relation { event_id }, + relates_to: Relation { event_id }, methods: vec![VerificationMethod::SasV1], }; @@ -137,7 +137,7 @@ mod tests { .unwrap(), ReadyEventContent { from_device, - relation: Relation { + relates_to: Relation { event_id }, methods, diff --git a/crates/ruma-events/src/key/verification/start.rs b/crates/ruma-events/src/key/verification/start.rs index 19c180cb..6b116afa 100644 --- a/crates/ruma-events/src/key/verification/start.rs +++ b/crates/ruma-events/src/key/verification/start.rs @@ -65,14 +65,14 @@ pub struct StartEventContent { /// Information about the related event. #[serde(rename = "m.relates_to")] - pub relation: Relation, + pub relates_to: Relation, } #[cfg(feature = "unstable-pre-spec")] impl StartEventContent { /// Creates a new `StartEventContent` with the given device ID, method and relation. - pub fn new(from_device: DeviceIdBox, method: StartMethod, relation: Relation) -> Self { - Self { from_device, method, relation } + pub fn new(from_device: DeviceIdBox, method: StartMethod, relates_to: Relation) -> Self { + Self { from_device, method, relates_to } } } @@ -420,7 +420,7 @@ mod tests { let key_verification_start_content = StartEventContent { from_device: "123".into(), - relation: Relation { event_id: event_id.clone() }, + relates_to: Relation { event_id: event_id.clone() }, method: StartMethod::SasV1( SasV1Content::new(SasV1ContentInit { hashes: vec![HashAlgorithm::Sha256], @@ -451,7 +451,7 @@ mod tests { let key_verification_start_content = StartEventContent { from_device: "123".into(), - relation: Relation { event_id: event_id.clone() }, + relates_to: Relation { event_id: event_id.clone() }, method: StartMethod::ReciprocateV1(ReciprocateV1Content::new(secret.clone())), }; @@ -636,7 +636,7 @@ mod tests { .unwrap(), StartEventContent { from_device, - relation: Relation { event_id }, + relates_to: Relation { event_id }, method: StartMethod::SasV1(SasV1Content { hashes, key_agreement_protocols, @@ -668,7 +668,7 @@ mod tests { .unwrap(), StartEventContent { from_device, - relation: Relation { event_id }, + relates_to: Relation { event_id }, method: StartMethod::ReciprocateV1(ReciprocateV1Content { secret }), } if from_device == "123" && event_id == id diff --git a/crates/ruma-events/src/room/encrypted.rs b/crates/ruma-events/src/room/encrypted.rs index 427cf25c..abe88809 100644 --- a/crates/ruma-events/src/room/encrypted.rs +++ b/crates/ruma-events/src/room/encrypted.rs @@ -42,19 +42,19 @@ pub struct EncryptedEventContent { /// /// [rich replies]: https://matrix.org/docs/spec/client_server/r0.6.1#rich-replies #[serde(flatten, with = "relation_serde", skip_serializing_if = "Option::is_none")] - pub relation: Option, + pub relates_to: Option, } impl EncryptedEventContent { /// Creates a new `EncryptedEventContent` with the given scheme and relation. pub fn new(scheme: EncryptedEventScheme, relates_to: Option) -> Self { - Self { scheme, relation: relates_to } + Self { scheme, relates_to } } } impl From for EncryptedEventContent { fn from(scheme: EncryptedEventScheme) -> Self { - Self { scheme, relation: None } + Self { scheme, relates_to: None } } } @@ -167,7 +167,7 @@ mod tests { device_id: "device_id".into(), session_id: "session_id".into(), }), - relation: Some(Relation::Reply { + relates_to: Some(Relation::Reply { in_reply_to: InReplyTo { event_id: event_id!("$h29iv0s8:example.com") }, }), }; @@ -223,7 +223,7 @@ mod tests { ); assert_matches!( - content.relation, + content.relates_to, Some(Relation::Reply { in_reply_to }) if in_reply_to.event_id == event_id!("$h29iv0s8:example.com") );