Upgrade Ruma after breaking change about Reply relations

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille
2026-03-03 19:00:59 +01:00
committed by Andy Balaam
parent 81286ad1e7
commit 12b1102ca9
7 changed files with 35 additions and 34 deletions
Generated
+9 -9
View File
@@ -4742,7 +4742,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.14.1"
source = "git+https://github.com/ruma/ruma?rev=f144deacadb4967044d48d63c49e41db4e3282f0#f144deacadb4967044d48d63c49e41db4e3282f0"
source = "git+https://github.com/ruma/ruma?rev=1bd55759b8ee083736d239b357c97ec82d12bba1#1bd55759b8ee083736d239b357c97ec82d12bba1"
dependencies = [
"assign",
"js_int",
@@ -4760,7 +4760,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.22.1"
source = "git+https://github.com/ruma/ruma?rev=f144deacadb4967044d48d63c49e41db4e3282f0#f144deacadb4967044d48d63c49e41db4e3282f0"
source = "git+https://github.com/ruma/ruma?rev=1bd55759b8ee083736d239b357c97ec82d12bba1#1bd55759b8ee083736d239b357c97ec82d12bba1"
dependencies = [
"as_variant",
"assign",
@@ -4783,7 +4783,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.17.1"
source = "git+https://github.com/ruma/ruma?rev=f144deacadb4967044d48d63c49e41db4e3282f0#f144deacadb4967044d48d63c49e41db4e3282f0"
source = "git+https://github.com/ruma/ruma?rev=1bd55759b8ee083736d239b357c97ec82d12bba1#1bd55759b8ee083736d239b357c97ec82d12bba1"
dependencies = [
"as_variant",
"base64",
@@ -4816,7 +4816,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.32.1"
source = "git+https://github.com/ruma/ruma?rev=f144deacadb4967044d48d63c49e41db4e3282f0#f144deacadb4967044d48d63c49e41db4e3282f0"
source = "git+https://github.com/ruma/ruma?rev=1bd55759b8ee083736d239b357c97ec82d12bba1#1bd55759b8ee083736d239b357c97ec82d12bba1"
dependencies = [
"as_variant",
"indexmap",
@@ -4843,7 +4843,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.13.1"
source = "git+https://github.com/ruma/ruma?rev=f144deacadb4967044d48d63c49e41db4e3282f0#f144deacadb4967044d48d63c49e41db4e3282f0"
source = "git+https://github.com/ruma/ruma?rev=1bd55759b8ee083736d239b357c97ec82d12bba1#1bd55759b8ee083736d239b357c97ec82d12bba1"
dependencies = [
"headers",
"http",
@@ -4864,7 +4864,7 @@ dependencies = [
[[package]]
name = "ruma-html"
version = "0.6.0"
source = "git+https://github.com/ruma/ruma?rev=f144deacadb4967044d48d63c49e41db4e3282f0#f144deacadb4967044d48d63c49e41db4e3282f0"
source = "git+https://github.com/ruma/ruma?rev=1bd55759b8ee083736d239b357c97ec82d12bba1#1bd55759b8ee083736d239b357c97ec82d12bba1"
dependencies = [
"as_variant",
"html5ever",
@@ -4875,7 +4875,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.12.0"
source = "git+https://github.com/ruma/ruma?rev=f144deacadb4967044d48d63c49e41db4e3282f0#f144deacadb4967044d48d63c49e41db4e3282f0"
source = "git+https://github.com/ruma/ruma?rev=1bd55759b8ee083736d239b357c97ec82d12bba1#1bd55759b8ee083736d239b357c97ec82d12bba1"
dependencies = [
"js_int",
"thiserror 2.0.17",
@@ -4884,7 +4884,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.17.1"
source = "git+https://github.com/ruma/ruma?rev=f144deacadb4967044d48d63c49e41db4e3282f0#f144deacadb4967044d48d63c49e41db4e3282f0"
source = "git+https://github.com/ruma/ruma?rev=1bd55759b8ee083736d239b357c97ec82d12bba1#1bd55759b8ee083736d239b357c97ec82d12bba1"
dependencies = [
"as_variant",
"cfg-if",
@@ -4900,7 +4900,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.19.0"
source = "git+https://github.com/ruma/ruma?rev=f144deacadb4967044d48d63c49e41db4e3282f0#f144deacadb4967044d48d63c49e41db4e3282f0"
source = "git+https://github.com/ruma/ruma?rev=1bd55759b8ee083736d239b357c97ec82d12bba1#1bd55759b8ee083736d239b357c97ec82d12bba1"
dependencies = [
"base64",
"ed25519-dalek",
+1 -1
View File
@@ -70,7 +70,7 @@ rand = { version = "0.8.5", default-features = false, features = ["std", "std_rn
regex = { version = "1.12.2", default-features = false }
reqwest = { version = "0.12.24", default-features = false }
rmp-serde = { version = "1.3.0", default-features = false }
ruma = { git = "https://github.com/ruma/ruma", rev = "f144deacadb4967044d48d63c49e41db4e3282f0", features = [
ruma = { git = "https://github.com/ruma/ruma", rev = "1bd55759b8ee083736d239b357c97ec82d12bba1", features = [
"client-api-c",
"compat-unset-avatar",
"compat-upload-signatures",
+1 -1
View File
@@ -472,7 +472,7 @@ impl TryFrom<AnySyncMessageLikeEvent> for MessageLikeEventContent {
let original_content = get_message_like_event_original_content(content)?;
let in_reply_to_event_id =
original_content.relates_to.and_then(|relation| match relation {
Relation::Reply { in_reply_to } => Some(in_reply_to.event_id.to_string()),
Relation::Reply(reply) => Some(reply.in_reply_to.event_id.to_string()),
_ => None,
});
MessageLikeEventContent::RoomMessage {
@@ -462,8 +462,8 @@ impl TimelineMetadata {
let mut thread_root = None;
let in_reply_to = relates_to.and_then(|relation| match relation {
RelationWithoutReplacement::Reply { in_reply_to } => {
Some(InReplyToDetails::new(in_reply_to.event_id, timeline_items))
RelationWithoutReplacement::Reply(reply) => {
Some(InReplyToDetails::new(reply.in_reply_to.event_id, timeline_items))
}
RelationWithoutReplacement::Thread(thread) => {
thread_root = Some(thread.event_id);
@@ -18,7 +18,6 @@ use ruma::{
events::{
Mentions,
reaction::RedactedReactionEventContent,
relation::InReplyTo,
room::{
ImageInfo,
encrypted::{
@@ -678,7 +677,8 @@ async fn test_send_reply() {
assert_next_matches!(timeline_stream, VectorDiff::Clear);
// Now, let's reply to a message sent by `BOB`.
server.mock_room_send()
server
.mock_room_send()
.respond_with(move |req: &Request| {
use ruma::events::room::message::RoomMessageEventContent;
@@ -686,8 +686,8 @@ async fn test_send_reply() {
.body_json::<RoomMessageEventContent>()
.expect("Failed to deserialize the event");
assert_matches!(reply_event.relates_to, Some(Relation::Reply { in_reply_to: InReplyTo { event_id, .. } }) => {
assert_eq!(event_id, event_id_from_bob);
assert_matches!(reply_event.relates_to, Some(Relation::Reply(reply)) => {
assert_eq!(reply.in_reply_to.event_id, event_id_from_bob);
});
assert_matches!(reply_event.mentions, Some(Mentions { user_ids, room: false, .. }) => {
assert_eq!(user_ids.len(), 1);
@@ -780,7 +780,8 @@ async fn test_send_reply_to_self() {
assert_next_matches!(timeline_stream, VectorDiff::Clear);
// Now, let's reply to a message sent by the current user.
server.mock_room_send()
server
.mock_room_send()
.respond_with(move |req: &Request| {
use ruma::events::room::message::RoomMessageEventContent;
@@ -788,8 +789,8 @@ async fn test_send_reply_to_self() {
.body_json::<RoomMessageEventContent>()
.expect("Failed to deserialize the event");
assert_matches!(reply_event.relates_to, Some(Relation::Reply { in_reply_to: InReplyTo { event_id, .. } }) => {
assert_eq!(event_id, event_id_from_self);
assert_matches!(reply_event.relates_to, Some(Relation::Reply(reply)) => {
assert_eq!(reply.in_reply_to.event_id, event_id_from_self);
});
assert!(reply_event.mentions.is_none());
@@ -944,7 +945,8 @@ async fn test_send_reply_with_event_id() {
assert_next_matches!(timeline_stream, VectorDiff::Clear);
// Now, let's reply to a message sent by `BOB`.
server.mock_room_send()
server
.mock_room_send()
.respond_with(move |req: &Request| {
use ruma::events::room::message::RoomMessageEventContent;
@@ -952,8 +954,8 @@ async fn test_send_reply_with_event_id() {
.body_json::<RoomMessageEventContent>()
.expect("Failed to deserialize the event");
assert_matches!(reply_event.relates_to, Some(Relation::Reply { in_reply_to: InReplyTo { event_id, .. } }) => {
assert_eq!(event_id, event_id_from_bob);
assert_matches!(reply_event.relates_to, Some(Relation::Reply(reply)) => {
assert_eq!(reply.in_reply_to.event_id, event_id_from_bob);
});
assert_matches!(reply_event.mentions, Some(Mentions { user_ids, room: false, .. }) => {
assert_eq!(user_ids.len(), 1);
@@ -1230,7 +1232,8 @@ async fn test_send_reply_with_event_id_that_is_redacted() {
assert_next_matches!(timeline_stream, VectorDiff::Clear);
// Now, let's reply to a message sent by `BOB`.
server.mock_room_send()
server
.mock_room_send()
.respond_with(move |req: &Request| {
use ruma::events::room::message::RoomMessageEventContent;
@@ -1238,8 +1241,8 @@ async fn test_send_reply_with_event_id_that_is_redacted() {
.body_json::<RoomMessageEventContent>()
.expect("Failed to deserialize the event");
assert_matches!(reply_event.relates_to, Some(Relation::Reply { in_reply_to: InReplyTo { event_id, .. } }) => {
assert_eq!(event_id, redacted_event_id_from_bob);
assert_matches!(reply_event.relates_to, Some(Relation::Reply(reply)) => {
assert_eq!(reply.in_reply_to.event_id, redacted_event_id_from_bob);
});
assert_matches!(reply_event.mentions, Some(Mentions { user_ids, room: false, .. }) => {
assert_eq!(user_ids.len(), 1);
+2 -2
View File
@@ -295,9 +295,9 @@ mod tests {
.await
.unwrap();
assert_let!(Some(Relation::Reply { in_reply_to }) = &reply_event.relates_to);
assert_let!(Some(Relation::Reply(reply)) = &reply_event.relates_to);
assert_eq!(in_reply_to.event_id, event_id);
assert_eq!(reply.in_reply_to.event_id, event_id);
}
#[async_test]
+4 -6
View File
@@ -57,7 +57,7 @@ use ruma::{
push_rules::PushRulesEventContent,
reaction::ReactionEventContent,
receipt::{Receipt, ReceiptEventContent, ReceiptThread, ReceiptType},
relation::{Annotation, BundledThread, InReplyTo, Reference, Replacement, Thread},
relation::{Annotation, BundledThread, Reference, Replacement, Reply, Thread},
room::{
ImageInfo,
avatar::{self, RoomAvatarEventContent},
@@ -443,8 +443,7 @@ impl EventBuilder<RoomEncryptedEventContent> {
impl EventBuilder<RoomMessageEventContent> {
/// Adds a reply relation to the current event.
pub fn reply_to(mut self, event_id: &EventId) -> Self {
self.content.relates_to =
Some(Relation::Reply { in_reply_to: InReplyTo::new(event_id.to_owned()) });
self.content.relates_to = Some(Relation::Reply(Reply::with_event_id(event_id.to_owned())));
self
}
@@ -518,9 +517,8 @@ impl EventBuilder<UnstablePollStartEventContent> {
/// Adds a reply relation to the current event.
pub fn reply_to(mut self, event_id: &EventId) -> Self {
if let UnstablePollStartEventContent::New(content) = &mut self.content {
content.relates_to = Some(RelationWithoutReplacement::Reply {
in_reply_to: InReplyTo::new(event_id.to_owned()),
});
content.relates_to =
Some(RelationWithoutReplacement::Reply(Reply::with_event_id(event_id.to_owned())));
}
self
}