events: Rename events::relation::Relations to BundledRelations
This commit is contained in:
parent
80056c8a35
commit
61a9d65b71
@ -37,6 +37,7 @@ Breaking changes:
|
||||
duplicate types
|
||||
* Remove `events::reaction::Relation` and use `events::relation::Annotation` instead
|
||||
* Remove `events::key::verification::Relation` and use `events::relation::Reference` instead
|
||||
* Rename `events::relation::Relations` to `BundledRelations`
|
||||
|
||||
Improvements:
|
||||
|
||||
|
@ -172,7 +172,7 @@ pub use self::{
|
||||
content::*,
|
||||
enums::*,
|
||||
kinds::*,
|
||||
relation::Relations,
|
||||
relation::BundledRelations,
|
||||
state_key::EmptyStateKey,
|
||||
unsigned::{MessageLikeUnsigned, RedactedUnsigned, StateUnsigned, StateUnsignedFromParts},
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ use serde_json::value::RawValue as RawJsonValue;
|
||||
|
||||
use super::{
|
||||
room::{encrypted, redaction::SyncRoomRedactionEvent},
|
||||
Redact, Relations,
|
||||
BundledRelations, Redact,
|
||||
};
|
||||
use crate::{
|
||||
serde::from_raw_json_value, EventId, MilliSecondsSinceUnixEpoch, OwnedRoomId, RoomId,
|
||||
@ -181,7 +181,7 @@ impl AnyTimelineEvent {
|
||||
pub fn transaction_id(&self) -> Option<&TransactionId>;
|
||||
|
||||
/// Returns this event's `relations` from inside `unsigned`, if that field exists.
|
||||
pub fn relations(&self) -> Option<&Relations>;
|
||||
pub fn relations(&self) -> Option<&BundledRelations>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ impl AnySyncTimelineEvent {
|
||||
pub fn transaction_id(&self) -> Option<&TransactionId>;
|
||||
|
||||
/// Returns this event's `relations` from inside `unsigned`, if that field exists.
|
||||
pub fn relations(&self) -> Option<&Relations>;
|
||||
pub fn relations(&self) -> Option<&BundledRelations>;
|
||||
}
|
||||
|
||||
/// Converts `self` to an `AnyTimelineEvent` by adding the given a room ID.
|
||||
|
@ -287,7 +287,7 @@ impl ReferenceChunk {
|
||||
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
pub struct Relations {
|
||||
pub struct BundledRelations {
|
||||
/// Annotation relations.
|
||||
#[cfg(feature = "unstable-msc2677")]
|
||||
#[serde(rename = "m.annotation")]
|
||||
@ -306,8 +306,8 @@ pub struct Relations {
|
||||
pub reference: Option<ReferenceChunk>,
|
||||
}
|
||||
|
||||
impl Relations {
|
||||
/// Creates a new empty `Relations`.
|
||||
impl BundledRelations {
|
||||
/// Creates a new empty `BundledRelations`.
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ use serde_json::{from_str as from_json_str, value::RawValue as RawJsonValue};
|
||||
|
||||
use crate::{
|
||||
events::{
|
||||
AnyStrippedStateEvent, EventContent, RedactContent, RedactedEventContent,
|
||||
RedactedStateEventContent, Relations, StateEventContent, StateEventType, StateUnsigned,
|
||||
AnyStrippedStateEvent, BundledRelations, EventContent, RedactContent, RedactedEventContent,
|
||||
RedactedStateEventContent, StateEventContent, StateEventType, StateUnsigned,
|
||||
StateUnsignedFromParts, StaticEventContent,
|
||||
},
|
||||
serde::{CanBeEmpty, Raw, StringEnum},
|
||||
@ -482,7 +482,7 @@ pub struct RoomMemberUnsigned {
|
||||
///
|
||||
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
||||
#[serde(rename = "m.relations", skip_serializing_if = "Option::is_none")]
|
||||
pub relations: Option<Relations>,
|
||||
pub relations: Option<BundledRelations>,
|
||||
}
|
||||
|
||||
impl RoomMemberUnsigned {
|
||||
|
@ -2,7 +2,9 @@ use js_int::Int;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{from_str as from_json_str, value::RawValue as RawJsonValue};
|
||||
|
||||
use super::{relation::Relations, room::redaction::SyncRoomRedactionEvent, StateEventContent};
|
||||
use super::{
|
||||
relation::BundledRelations, room::redaction::SyncRoomRedactionEvent, StateEventContent,
|
||||
};
|
||||
use crate::{
|
||||
serde::{CanBeEmpty, Raw},
|
||||
OwnedTransactionId,
|
||||
@ -29,7 +31,7 @@ pub struct MessageLikeUnsigned {
|
||||
///
|
||||
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
||||
#[serde(rename = "m.relations", skip_serializing_if = "Option::is_none")]
|
||||
pub relations: Option<Relations>,
|
||||
pub relations: Option<BundledRelations>,
|
||||
}
|
||||
|
||||
impl MessageLikeUnsigned {
|
||||
@ -75,7 +77,7 @@ pub struct StateUnsigned<C: StateEventContent> {
|
||||
///
|
||||
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
||||
#[serde(rename = "m.relations", skip_serializing_if = "Option::is_none")]
|
||||
pub relations: Option<Relations>,
|
||||
pub relations: Option<BundledRelations>,
|
||||
}
|
||||
|
||||
impl<C: StateEventContent> StateUnsigned<C> {
|
||||
@ -118,7 +120,7 @@ impl<C: StateEventContent> StateUnsignedFromParts for StateUnsigned<C> {
|
||||
transaction_id: Option<OwnedTransactionId>,
|
||||
prev_content: Option<Raw<C>>,
|
||||
#[serde(rename = "m.relations", skip_serializing_if = "Option::is_none")]
|
||||
relations: Option<Relations>,
|
||||
relations: Option<BundledRelations>,
|
||||
}
|
||||
|
||||
let raw: WithRawPrevContent<C> = from_json_str(object.get())?;
|
||||
|
@ -595,7 +595,7 @@ fn expand_accessor_methods(
|
||||
}
|
||||
|
||||
/// Returns this event's `relations` from inside `unsigned`, if that field exists.
|
||||
pub fn relations(&self) -> Option<&#ruma_common::events::Relations> {
|
||||
pub fn relations(&self) -> Option<&#ruma_common::events::BundledRelations> {
|
||||
match self {
|
||||
#(
|
||||
#variants2(event) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user