Skip to content

Upgrade Ruma #5347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ reqwest = { version = "0.12.12", default-features = false }
rmp-serde = "1.3.0"
# Be careful to use commits from the https://github.com/ruma/ruma/tree/ruma-0.12
# branch until a proper release with breaking changes happens.
ruma = { git = "https://github.com/ruma/ruma", rev = "d1d53e2b7aaf9190f11a5465b9edf6a19fc5b59a", features = [
ruma = { git = "https://github.com/ruma/ruma", rev = "724ed061ae3bf9a2b5ccfdbcd500e77e6069a3be", features = [
"client-api-c",
"compat-upload-signatures",
"compat-user-id",
"compat-arbitrary-length-ids",
"compat-tag-info",
"compat-encrypted-stickers",
"compat-lax-room-create-deser",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new compat feature that allows some fields of m.room.create events to be ignored if they fail during deserialization. That way we can still access the other properties of the event.

"unstable-msc3401",
"unstable-msc3266",
"unstable-msc3488",
"unstable-msc3489",
"unstable-msc4075",
Expand All @@ -78,7 +78,7 @@ ruma = { git = "https://github.com/ruma/ruma", rev = "d1d53e2b7aaf9190f11a5465b9
"unstable-msc4278",
"unstable-msc4286",
] }
ruma-common = { git = "https://github.com/ruma/ruma", rev = "d1d53e2b7aaf9190f11a5465b9edf6a19fc5b59a" }
ruma-common = { git = "https://github.com/ruma/ruma", rev = "724ed061ae3bf9a2b5ccfdbcd500e77e6069a3be" }
sentry = "0.36.0"
sentry-tracing = "0.36.0"
serde = { version = "1.0.217", features = ["rc"] }
Expand Down
2 changes: 1 addition & 1 deletion bindings/matrix-sdk-ffi/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use matrix_sdk::{
api::client::{
discovery::{
discover_homeserver::RtcFocusInfo,
get_authorization_server_metadata::msc2965::Prompt as RumaOidcPrompt,
get_authorization_server_metadata::v1::Prompt as RumaOidcPrompt,
},
push::{EmailPusherData, PusherIds, PusherInit, PusherKind as RumaPusherKind},
room::{create_room, Visibility},
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ rand = { workspace = true, optional = true }
ruma = { workspace = true, features = [
"rand",
"unstable-msc2448",
"unstable-msc2965",
"unstable-msc4191",
"unstable-msc3930",
"unstable-msc3245-v1-compat",
"unstable-msc4230",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! This is a Matrix extension introduced in [MSC4191](https://github.com/matrix-org/matrix-spec-proposals/pull/4191).

use ruma::{
api::client::discovery::get_authorization_server_metadata::msc2965::AccountManagementAction,
api::client::discovery::get_authorization_server_metadata::v1::AccountManagementAction,
OwnedDeviceId,
};
use url::Url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ use oauth2::{
basic::BasicClient as OAuthClient, AuthUrl, CsrfToken, PkceCodeChallenge, RedirectUrl, Scope,
};
use ruma::{
api::client::discovery::get_authorization_server_metadata::msc2965::Prompt, OwnedDeviceId,
UserId,
api::client::discovery::get_authorization_server_metadata::v1::Prompt, OwnedDeviceId, UserId,
};
use tracing::{info, instrument};
use url::Url;
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/authentication/oauth/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub use oauth2::{
StandardErrorResponse,
};
use ruma::{
api::client::discovery::get_authorization_server_metadata::msc2965::AuthorizationServerMetadataUrlError,
api::client::discovery::get_authorization_server_metadata::v1::AuthorizationServerMetadataUrlError,
serde::{PartialEqAsRefStr, StringEnum},
};

Expand Down
25 changes: 12 additions & 13 deletions crates/matrix-sdk/src/authentication/oauth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ pub use oauth2::{ClientId, CsrfToken};
use ruma::{
api::client::discovery::get_authorization_server_metadata::{
self,
msc2965::{AccountManagementAction, AuthorizationServerMetadata},
v1::{AccountManagementAction, AuthorizationServerMetadata},
},
serde::Raw,
DeviceId, OwnedDeviceId,
Expand Down Expand Up @@ -577,18 +577,17 @@ impl OAuth {
.is_some_and(|err| err.status_code == http::StatusCode::NOT_FOUND)
};

let response = self
.client
.send(get_authorization_server_metadata::msc2965::Request::new())
.await
.map_err(|error| {
// If the endpoint returns a 404, i.e. the server doesn't support the endpoint.
if is_endpoint_unsupported(&error) {
OAuthDiscoveryError::NotSupported
} else {
error.into()
}
})?;
let response =
self.client.send(get_authorization_server_metadata::v1::Request::new()).await.map_err(
|error| {
// If the endpoint returns a 404, i.e. the server doesn't support the endpoint.
if is_endpoint_unsupported(&error) {
OAuthDiscoveryError::NotSupported
} else {
error.into()
}
},
)?;

let metadata = response.metadata.deserialize()?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use matrix_sdk_base::{
};
use oauth2::{DeviceCodeErrorResponseType, StandardDeviceAuthorizationResponse};
use ruma::{
api::client::discovery::get_authorization_server_metadata::msc2965::AuthorizationServerMetadata,
api::client::discovery::get_authorization_server_metadata::v1::AuthorizationServerMetadata,
OwnedDeviceId,
};
use tracing::trace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use language_tags::LanguageTag;
use matrix_sdk_base::deserialized_responses::PrivOwnedStr;
use oauth2::{AsyncHttpClient, ClientId, HttpClientError, RequestTokenError};
use ruma::{
api::client::discovery::get_authorization_server_metadata::msc2965::{GrantType, ResponseType},
api::client::discovery::get_authorization_server_metadata::v1::{GrantType, ResponseType},
serde::{PartialEqAsRefStr, Raw, StringEnum},
SecondsSinceUnixEpoch,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/authentication/oauth/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use matrix_sdk_base::store::RoomLoadSettings;
use matrix_sdk_test::async_test;
use oauth2::{ClientId, CsrfToken, PkceCodeChallenge, RedirectUrl};
use ruma::{
api::client::discovery::get_authorization_server_metadata::msc2965::Prompt, device_id,
api::client::discovery::get_authorization_server_metadata::v1::Prompt, device_id,
owned_device_id, user_id, DeviceId, ServerName,
};
use tokio::sync::broadcast::error::TryRecvError;
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/client/caches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

use matrix_sdk_base::ttl_cache::TtlCache;
use ruma::api::client::discovery::get_authorization_server_metadata::msc2965::AuthorizationServerMetadata;
use ruma::api::client::discovery::get_authorization_server_metadata::v1::AuthorizationServerMetadata;
use tokio::sync::RwLock;

use super::ClientServerInfo;
Expand Down
30 changes: 12 additions & 18 deletions crates/matrix-sdk/src/room_preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use futures_util::future::join_all;
use matrix_sdk_base::{RoomHero, RoomInfo, RoomState};
use ruma::{
api::client::{membership::joined_members, state::get_state_events},
directory::PublicRoomJoinRule,
events::room::{history_visibility::HistoryVisibility, join_rules::JoinRule},
room::RoomType,
space::SpaceRoomJoinRule,
Expand Down Expand Up @@ -253,7 +252,7 @@ impl RoomPreview {
let own_server_name = client.session_meta().map(|s| s.user_id.server_name());
let via = ensure_server_names_is_not_empty(own_server_name, via, room_or_alias_id);

let request = ruma::api::client::room::get_summary::msc3266::Request::new(
let request = ruma::api::client::room::get_summary::v1::Request::new(
room_or_alias_id.to_owned(),
via,
);
Expand All @@ -278,17 +277,19 @@ impl RoomPreview {
None
};

let summary = response.summary;

Ok(RoomPreview {
room_id,
canonical_alias: response.canonical_alias,
name: response.name,
topic: response.topic,
avatar_url: response.avatar_url,
num_joined_members: response.num_joined_members.into(),
canonical_alias: summary.canonical_alias,
name: summary.name,
topic: summary.topic,
avatar_url: summary.avatar_url,
num_joined_members: summary.num_joined_members.into(),
num_active_members,
room_type: response.room_type,
join_rule: Some(response.join_rule),
is_world_readable: Some(response.world_readable),
room_type: summary.room_type,
join_rule: Some(summary.join_rule.into()),
is_world_readable: Some(summary.world_readable),
state,
is_direct,
heroes: cached_room.map(|r| r.heroes()),
Expand Down Expand Up @@ -375,14 +376,7 @@ async fn search_for_room_preview_in_room_directory(
num_active_members: None,
// Assume it's a room
room_type: None,
join_rule: Some(match room_description.join_rule {
PublicRoomJoinRule::Public => SpaceRoomJoinRule::Public,
PublicRoomJoinRule::Knock => SpaceRoomJoinRule::Knock,
PublicRoomJoinRule::_Custom(rule) => SpaceRoomJoinRule::_Custom(rule),
_ => {
panic!("Unexpected PublicRoomJoinRule {:?}", room_description.join_rule)
}
}),
join_rule: Some(room_description.join_rule.into()),
is_world_readable: Some(room_description.is_world_readable),
state: None,
is_direct: None,
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/test_utils/mocks/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//! Helpers to mock an OAuth 2.0 server for the purpose of integration tests.

use ruma::{
api::client::discovery::get_authorization_server_metadata::msc2965::AuthorizationServerMetadata,
api::client::discovery::get_authorization_server_metadata::v1::AuthorizationServerMetadata,
serde::Raw,
};
use serde_json::json;
Expand Down
Loading