Upgrade Ruma

This commit is contained in:
Jonas Platte
2023-07-12 12:02:07 +02:00
committed by Jonas Platte
parent 8c3af12e47
commit 63babcd35a
8 changed files with 53 additions and 30 deletions

53
Cargo.lock generated
View File

@@ -944,6 +944,12 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "const_panic"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b"
[[package]]
name = "constant_time_eq"
version = "0.2.6"
@@ -2185,7 +2191,6 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
"serde",
]
[[package]]
@@ -2196,6 +2201,7 @@ checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
dependencies = [
"equivalent",
"hashbrown 0.14.0",
"serde",
]
[[package]]
@@ -2350,25 +2356,30 @@ dependencies = [
[[package]]
name = "konst"
version = "0.2.19"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330f0e13e6483b8c34885f7e6c9f19b1a7bd449c673fbb948a51c99d66ef74f4"
checksum = "1d9a8bb6c7c71d151b25936b03e012a4c00daea99e3a3797c6ead66b0a0d55e2"
dependencies = [
"konst_macro_rules",
"const_panic",
"konst_kernel",
"konst_proc_macros",
"typewit",
]
[[package]]
name = "konst_macro_rules"
version = "0.2.19"
name = "konst_kernel"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37"
checksum = "55d2ab266022e7309df89ed712bddc753e3a3c395c3ced1bb2e4470ec2a8146d"
dependencies = [
"typewit",
]
[[package]]
name = "konst_proc_macros"
version = "0.2.11"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "984e109462d46ad18314f10e392c286c3d47bce203088a09012de1015b45b737"
checksum = "4e28ab1dc35e09d60c2b8c90d12a9a8d9666c876c10a3739a3196db0103b6043"
[[package]]
name = "kv-log-macro"
@@ -4170,7 +4181,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.8.2"
source = "git+https://github.com/ruma/ruma?rev=5fde57460aaa71e16ac68f79376843089f9c3dfc#5fde57460aaa71e16ac68f79376843089f9c3dfc"
source = "git+https://github.com/ruma/ruma?rev=a641adb4287267ba9c4778ac1ee83b4ecab11e26#a641adb4287267ba9c4778ac1ee83b4ecab11e26"
dependencies = [
"assign",
"js_int",
@@ -4185,7 +4196,7 @@ dependencies = [
[[package]]
name = "ruma-appservice-api"
version = "0.8.1"
source = "git+https://github.com/ruma/ruma?rev=5fde57460aaa71e16ac68f79376843089f9c3dfc#5fde57460aaa71e16ac68f79376843089f9c3dfc"
source = "git+https://github.com/ruma/ruma?rev=a641adb4287267ba9c4778ac1ee83b4ecab11e26#a641adb4287267ba9c4778ac1ee83b4ecab11e26"
dependencies = [
"js_int",
"ruma-common",
@@ -4196,7 +4207,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.16.2"
source = "git+https://github.com/ruma/ruma?rev=5fde57460aaa71e16ac68f79376843089f9c3dfc#5fde57460aaa71e16ac68f79376843089f9c3dfc"
source = "git+https://github.com/ruma/ruma?rev=a641adb4287267ba9c4778ac1ee83b4ecab11e26#a641adb4287267ba9c4778ac1ee83b4ecab11e26"
dependencies = [
"assign",
"bytes",
@@ -4213,7 +4224,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.11.3"
source = "git+https://github.com/ruma/ruma?rev=5fde57460aaa71e16ac68f79376843089f9c3dfc#5fde57460aaa71e16ac68f79376843089f9c3dfc"
source = "git+https://github.com/ruma/ruma?rev=a641adb4287267ba9c4778ac1ee83b4ecab11e26#a641adb4287267ba9c4778ac1ee83b4ecab11e26"
dependencies = [
"base64 0.21.2",
"bytes",
@@ -4221,7 +4232,7 @@ dependencies = [
"getrandom 0.2.10",
"html5ever",
"http",
"indexmap 1.9.3",
"indexmap 2.0.0",
"js-sys",
"js_int",
"js_option",
@@ -4246,7 +4257,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.7.1"
source = "git+https://github.com/ruma/ruma?rev=5fde57460aaa71e16ac68f79376843089f9c3dfc#5fde57460aaa71e16ac68f79376843089f9c3dfc"
source = "git+https://github.com/ruma/ruma?rev=a641adb4287267ba9c4778ac1ee83b4ecab11e26#a641adb4287267ba9c4778ac1ee83b4ecab11e26"
dependencies = [
"js_int",
"ruma-common",
@@ -4257,7 +4268,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.9.1"
source = "git+https://github.com/ruma/ruma?rev=5fde57460aaa71e16ac68f79376843089f9c3dfc#5fde57460aaa71e16ac68f79376843089f9c3dfc"
source = "git+https://github.com/ruma/ruma?rev=a641adb4287267ba9c4778ac1ee83b4ecab11e26#a641adb4287267ba9c4778ac1ee83b4ecab11e26"
dependencies = [
"js_int",
"thiserror",
@@ -4266,7 +4277,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.11.3"
source = "git+https://github.com/ruma/ruma?rev=5fde57460aaa71e16ac68f79376843089f9c3dfc#5fde57460aaa71e16ac68f79376843089f9c3dfc"
source = "git+https://github.com/ruma/ruma?rev=a641adb4287267ba9c4778ac1ee83b4ecab11e26#a641adb4287267ba9c4778ac1ee83b4ecab11e26"
dependencies = [
"once_cell",
"proc-macro-crate",
@@ -4281,7 +4292,7 @@ dependencies = [
[[package]]
name = "ruma-push-gateway-api"
version = "0.7.1"
source = "git+https://github.com/ruma/ruma?rev=5fde57460aaa71e16ac68f79376843089f9c3dfc#5fde57460aaa71e16ac68f79376843089f9c3dfc"
source = "git+https://github.com/ruma/ruma?rev=a641adb4287267ba9c4778ac1ee83b4ecab11e26#a641adb4287267ba9c4778ac1ee83b4ecab11e26"
dependencies = [
"js_int",
"ruma-common",
@@ -5275,6 +5286,12 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "typewit"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4061a10d4d8f3081a8ccc025182afd8434302d8d4b4503ec6d8510d09df08c2d"
[[package]]
name = "ulid"
version = "1.0.0"

View File

@@ -35,8 +35,8 @@ futures-executor = "0.3.21"
futures-util = { version = "0.3.26", default-features = false, features = ["alloc"] }
http = "0.2.6"
itertools = "0.11.0"
ruma = { git = "https://github.com/ruma/ruma", rev = "5fde57460aaa71e16ac68f79376843089f9c3dfc", features = ["client-api-c", "compat-user-id"] }
ruma-common = { git = "https://github.com/ruma/ruma", rev = "5fde57460aaa71e16ac68f79376843089f9c3dfc" }
ruma = { git = "https://github.com/ruma/ruma", rev = "a641adb4287267ba9c4778ac1ee83b4ecab11e26", features = ["client-api-c", "compat-user-id"] }
ruma-common = { git = "https://github.com/ruma/ruma", rev = "a641adb4287267ba9c4778ac1ee83b4ecab11e26" }
once_cell = "1.16.0"
serde = "1.0.151"
serde_html_form = "0.2.0"

View File

@@ -433,7 +433,7 @@ impl Room {
let replacement = Replacement::new(
event_id.to_owned(),
MessageType::text_markdown(new_msg.to_owned()),
MessageType::text_markdown(new_msg.to_owned()).into(),
);
let mut edited_content = RoomMessageEventContent::text_markdown(new_msg);

View File

@@ -26,7 +26,10 @@ use ruma::{
room::{
encrypted::RoomEncryptedEventContent,
member::RoomMemberEventContent,
message::{self, sanitize::RemoveReplyFallback, MessageType, RoomMessageEventContent},
message::{
self, sanitize::RemoveReplyFallback, RoomMessageEventContent,
RoomMessageEventContentWithoutRelation,
},
redaction::{
OriginalSyncRoomRedactionEvent, RoomRedactionEventContent, SyncRoomRedactionEvent,
},
@@ -371,7 +374,10 @@ impl<'a> TimelineEventHandler<'a> {
}
#[instrument(skip_all, fields(replacement_event_id = ?replacement.event_id))]
fn handle_room_message_edit(&mut self, replacement: Replacement<MessageType>) {
fn handle_room_message_edit(
&mut self,
replacement: Replacement<RoomMessageEventContentWithoutRelation>,
) {
update_timeline_item!(self, &replacement.event_id, "edit", |event_item| {
if self.meta.sender != event_item.sender() {
info!(
@@ -408,7 +414,7 @@ impl<'a> TimelineEventHandler<'a> {
}
};
let mut msgtype = replacement.new_content;
let mut msgtype = replacement.new_content.msgtype;
// Edit's content is never supposed to contain the reply fallback.
msgtype.sanitize(DEFAULT_SANITIZER_MODE, RemoveReplyFallback::No);

View File

@@ -325,8 +325,8 @@ impl Message {
let msgtype = match edit {
Some(mut e) => {
// Edit's content is never supposed to contain the reply fallback.
e.new_content.sanitize(DEFAULT_SANITIZER_MODE, RemoveReplyFallback::No);
e.new_content
e.new_content.msgtype.sanitize(DEFAULT_SANITIZER_MODE, RemoveReplyFallback::No);
e.new_content.msgtype
}
None => {
let remove_reply_fallback = if in_reply_to.is_some() {

View File

@@ -48,7 +48,7 @@ async fn live_redacted() {
let edit = assign!(RoomMessageEventContent::text_plain(" * test"), {
relates_to: Some(message::Relation::Replacement(Replacement::new(
redacted_event_id.to_owned(),
MessageType::text_plain("test"),
MessageType::text_plain("test").into(),
))),
});
timeline.handle_live_message_event(&ALICE, edit).await;
@@ -92,7 +92,7 @@ async fn live_sanitized() {
{
relates_to: Some(message::Relation::Replacement(Replacement::new(
first_event_id.to_owned(),
MessageType::text_html(new_plain_content, new_html_content),
MessageType::text_html(new_plain_content, new_html_content).into(),
))),
}
);

View File

@@ -54,7 +54,7 @@ async fn default_filter() {
let edit = assign!(RoomMessageEventContent::text_plain(" * The _edited_ first message"), {
relates_to: Some(Relation::Replacement(Replacement::new(
first_event_id.to_owned(),
MessageType::text_plain("The _edited_ first message"),
MessageType::text_plain("The _edited_ first message").into(),
))),
});
timeline.handle_live_message_event(&ALICE, edit).await;

View File

@@ -45,7 +45,7 @@ async fn invalid_edit() {
let edit = assign!(RoomMessageEventContent::text_plain(" * fake"), {
relates_to: Some(message::Relation::Replacement(Replacement::new(
msg_event_id.to_owned(),
MessageType::text_plain("fake"),
MessageType::text_plain("fake").into(),
))),
});
// Edit is from a different user than the previous event