common: Clarify that reactions are not all emojis
According to MSC2677
This commit is contained in:
parent
f0c8703ee5
commit
2d88df7fb7
@ -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(),
|
||||
|
@ -32,23 +32,27 @@ impl From<Relation> 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<EventId>,
|
||||
|
||||
/// 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<EventId>, emoji: String) -> Self {
|
||||
Self { event_id, emoji }
|
||||
/// Creates a new `Relation` with the given event ID and key.
|
||||
pub fn new(event_id: Box<EventId>, key: String) -> Self {
|
||||
Self { event_id, key }
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,8 +78,8 @@ mod tests {
|
||||
|
||||
assert_matches!(
|
||||
from_json_value::<ReactionEventContent>(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 == "🦛"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user