diff --git a/crates/ruma-common/src/events/enums.rs b/crates/ruma-common/src/events/enums.rs index dc83ed7d..67cdfb92 100644 --- a/crates/ruma-common/src/events/enums.rs +++ b/crates/ruma-common/src/events/enums.rs @@ -354,10 +354,10 @@ impl AnyMessageLikeEventContent { Self::Reaction(ev) => { use super::reaction; - let reaction::Relation { event_id, emoji } = &ev.relates_to; + let reaction::Relation { event_id, key } = &ev.relates_to; Some(encrypted::Relation::Annotation(encrypted::Annotation { event_id: event_id.clone(), - key: emoji.clone(), + key: key.clone(), })) } Self::RoomEncrypted(ev) => ev.relates_to.clone(), diff --git a/crates/ruma-common/src/events/reaction.rs b/crates/ruma-common/src/events/reaction.rs index 7627f2ce..4d26761d 100644 --- a/crates/ruma-common/src/events/reaction.rs +++ b/crates/ruma-common/src/events/reaction.rs @@ -32,23 +32,27 @@ impl From for ReactionEventContent { } } -/// The relation that contains info which event the reaction is applying to. +/// Information about an annotation relation. #[derive(Clone, Debug, Deserialize, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[serde(tag = "rel_type", rename = "m.annotation")] pub struct Relation { - /// The event that is being reacted to. + /// The event that is being annoted. pub event_id: Box, - /// A string that holds the emoji reaction. - #[serde(rename = "key")] - pub emoji: String, + /// A string that indicates the annotation being applied. + /// + /// When sending emoji reactions, this field should include the colourful variation-16 when + /// applicable. + /// + /// Clients should render reactions that have a long `key` field in a sensible manner. + pub key: String, } impl Relation { - /// Creates a new `Relation` with the given event ID and emoji. - pub fn new(event_id: Box, emoji: String) -> Self { - Self { event_id, emoji } + /// Creates a new `Relation` with the given event ID and key. + pub fn new(event_id: Box, key: String) -> Self { + Self { event_id, key } } } @@ -74,8 +78,8 @@ mod tests { assert_matches!( from_json_value::(json).unwrap(), - ReactionEventContent { relates_to: Relation { event_id, emoji } } - if event_id == ev_id && emoji == "🦛" + ReactionEventContent { relates_to: Relation { event_id, key } } + if event_id == ev_id && key == "🦛" ); } } diff --git a/crates/ruma-common/src/events/relation.rs b/crates/ruma-common/src/events/relation.rs index 519e6dea..5fa05e95 100644 --- a/crates/ruma-common/src/events/relation.rs +++ b/crates/ruma-common/src/events/relation.rs @@ -12,7 +12,7 @@ use crate::{EventId, MilliSecondsSinceUnixEpoch, UserId}; #[cfg(feature = "unstable-msc2677")] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct BundledReaction { - /// The key (emoji) used for reaction. + /// The key used for the reaction. pub key: String, /// Time of the bundled reaction being compiled on the server.