Skip to content

Commit 4931c07

Browse files
authored
Upgrade Ruma again
This patch updates our `Raw` API usage since the newly added `JsonCastable` that disallows Raw casts that are known to fail deserialization. Signed-off-by: Kévin Commaille <[email protected]>
1 parent 37626b5 commit 4931c07

File tree

72 files changed

+288
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+288
-221
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ proptest = { version = "1.6.0", default-features = false, features = ["std"] }
5959
rand = "0.8.5"
6060
reqwest = { version = "0.12.12", default-features = false }
6161
rmp-serde = "1.3.0"
62-
ruma = { git = "https://github.com/ruma/ruma", rev = "a3663c04511f79f99376924d739f84d839600de6", features = [
62+
ruma = { git = "https://github.com/ruma/ruma", rev = "7bae3d0c0b8edf008899ac2b04cf9722182eef68", features = [
6363
"client-api-c",
6464
"compat-upload-signatures",
6565
"compat-arbitrary-length-ids",
@@ -77,7 +77,7 @@ ruma = { git = "https://github.com/ruma/ruma", rev = "a3663c04511f79f99376924d73
7777
"unstable-msc4278",
7878
"unstable-msc4286",
7979
] }
80-
ruma-common = { git = "https://github.com/ruma/ruma", rev = "a3663c04511f79f99376924d739f84d839600de6" }
80+
ruma-common = { git = "https://github.com/ruma/ruma", rev = "7bae3d0c0b8edf008899ac2b04cf9722182eef68" }
8181
sentry = "0.36.0"
8282
sentry-tracing = "0.36.0"
8383
serde = { version = "1.0.217", features = ["rc"] }

bindings/matrix-sdk-ffi/src/notification_settings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl TryFrom<SdkPushCondition> for PushCondition {
172172
Self::RoomMemberCount { prefix: is.prefix.into(), count: is.count.into() }
173173
}
174174
SdkPushCondition::SenderNotificationPermission { key } => {
175-
Self::SenderNotificationPermission { key }
175+
Self::SenderNotificationPermission { key: key.to_string() }
176176
}
177177
SdkPushCondition::EventPropertyIs { key, value } => {
178178
Self::EventPropertyIs { key, value: value.into() }
@@ -197,7 +197,7 @@ impl From<PushCondition> for SdkPushCondition {
197197
},
198198
},
199199
PushCondition::SenderNotificationPermission { key } => {
200-
Self::SenderNotificationPermission { key }
200+
Self::SenderNotificationPermission { key: key.into() }
201201
}
202202
PushCondition::EventPropertyIs { key, value } => {
203203
Self::EventPropertyIs { key, value: value.into() }

crates/matrix-sdk-base/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ impl BaseClient {
10401040
) -> Result<Ruleset> {
10411041
if let Some(event) = global_account_data_processor
10421042
.push_rules()
1043-
.and_then(|ev| ev.deserialize_as::<PushRulesEvent>().ok())
1043+
.and_then(|ev| ev.deserialize_as_unchecked::<PushRulesEvent>().ok())
10441044
{
10451045
Ok(event.content.global)
10461046
} else if let Some(event) = self

crates/matrix-sdk-base/src/deserialized_responses.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ impl RawAnySyncOrStrippedState {
304304
C::Redacted: RedactedStateEventContent,
305305
{
306306
match self {
307-
Self::Sync(raw) => RawSyncOrStrippedState::Sync(raw.cast()),
308-
Self::Stripped(raw) => RawSyncOrStrippedState::Stripped(raw.cast()),
307+
Self::Sync(raw) => RawSyncOrStrippedState::Sync(raw.cast_unchecked()),
308+
Self::Stripped(raw) => RawSyncOrStrippedState::Stripped(raw.cast_unchecked()),
309309
}
310310
}
311311
}

crates/matrix-sdk-base/src/latest_event.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ mod tests {
345345
AnySyncMessageLikeEvent, AnySyncStateEvent, AnySyncTimelineEvent, EmptyStateKey,
346346
Mentions, MessageLikeUnsigned, OriginalSyncMessageLikeEvent, OriginalSyncStateEvent,
347347
RedactedSyncMessageLikeEvent, RedactedUnsigned, StateUnsigned, SyncMessageLikeEvent,
348-
UnsignedRoomRedactionEvent,
349348
},
350349
owned_event_id, owned_mxc_uri, owned_user_id, MilliSecondsSinceUnixEpoch, UInt,
351350
VoipVersionId,
@@ -501,7 +500,7 @@ mod tests {
501500
#[test]
502501
fn test_redacted_messages_are_suitable() {
503502
// Ruma does not allow constructing UnsignedRoomRedactionEvent instances.
504-
let room_redaction_event: UnsignedRoomRedactionEvent = serde_json::from_value(json!({
503+
let room_redaction_event = serde_json::from_value(json!({
505504
"content": {},
506505
"event_id": "$redaction",
507506
"sender": "@x:y.za",

crates/matrix-sdk-base/src/response_processors/changes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ fn apply_changes(
8080
if let Some(event) =
8181
context.state_changes.account_data.get(&GlobalAccountDataEventType::IgnoredUserList)
8282
{
83-
match event.deserialize_as::<IgnoredUserListEvent>() {
83+
match event.deserialize_as_unchecked::<IgnoredUserListEvent>() {
8484
Ok(event) => {
8585
let user_ids: Vec<String> =
8686
event.content.ignored_users.keys().map(|id| id.to_string()).collect();

crates/matrix-sdk-base/src/response_processors/e2ee/decrypt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub async fn sync_timeline_event(
3535

3636
Ok(Some(
3737
match olm
38-
.try_decrypt_room_event(event.cast_ref(), room_id, e2ee.decryption_settings)
38+
.try_decrypt_room_event(event.cast_ref_unchecked(), room_id, e2ee.decryption_settings)
3939
.await?
4040
{
4141
RoomEventDecryptionResult::Decrypted(decrypted) => {

crates/matrix-sdk-base/src/response_processors/latest_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async fn decrypt_sync_room_event(
111111
let event = match e2ee
112112
.olm_machine
113113
.expect("An `OlmMachine` is expected")
114-
.try_decrypt_room_event(event.cast_ref(), room_id, e2ee.decryption_settings)
114+
.try_decrypt_room_event(event.cast_ref_unchecked(), room_id, e2ee.decryption_settings)
115115
.await?
116116
{
117117
RoomEventDecryptionResult::Decrypted(decrypted) => {

crates/matrix-sdk-base/src/response_processors/state_events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub mod sync {
6464
super::collect(raw_events.iter().filter_map(|raw_event| {
6565
// Only state events have a `state_key` field.
6666
match raw_event.get_field::<&str>("state_key") {
67-
Ok(Some(_)) => Some(raw_event.cast_ref()),
67+
Ok(Some(_)) => Some(raw_event.cast_ref_unchecked()),
6868
_ => None,
6969
}
7070
}))

0 commit comments

Comments
 (0)