From 13ad2c7966d152814208627f1e45a7731c153acf Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 30 Jan 2026 21:16:26 +0000 Subject: [PATCH] Fix m.tz identifier and bias to stable. Bump Ruma; enable spec versions 1.12 and 1.15. Signed-off-by: Jason Volk --- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 2 +- src/api/client/profile.rs | 4 ++-- src/api/client/unversioned.rs | 2 ++ src/service/users/profile.rs | 14 +++++--------- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 012b52a5..5af01b57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3680,7 +3680,7 @@ dependencies = [ [[package]] name = "ruma" version = "0.13.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "assign", "js_int", @@ -3699,7 +3699,7 @@ dependencies = [ [[package]] name = "ruma-appservice-api" version = "0.13.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "js_int", "ruma-common", @@ -3711,7 +3711,7 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.21.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "as_variant", "assign", @@ -3736,7 +3736,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.16.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "as_variant", "base64", @@ -3770,7 +3770,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.31.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "as_variant", "indexmap", @@ -3797,7 +3797,7 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.12.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "bytes", "headers", @@ -3820,7 +3820,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.11.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "js_int", "thiserror 2.0.18", @@ -3829,7 +3829,7 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.16.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "cfg-if", "proc-macro-crate", @@ -3844,7 +3844,7 @@ dependencies = [ [[package]] name = "ruma-push-gateway-api" version = "0.12.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "js_int", "ruma-common", @@ -3856,7 +3856,7 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.18.0" -source = "git+https://github.com/matrix-construct/ruma?rev=1311829cb73986ff8da4837e98a588860712630f#1311829cb73986ff8da4837e98a588860712630f" +source = "git+https://github.com/matrix-construct/ruma?rev=069b3f6ee7499cdac84175946aeb9443d2578363#069b3f6ee7499cdac84175946aeb9443d2578363" dependencies = [ "base64", "ed25519-dalek", diff --git a/Cargo.toml b/Cargo.toml index 0011cf69..01225930 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -327,7 +327,7 @@ default-features = false [workspace.dependencies.ruma] git = "https://github.com/matrix-construct/ruma" -rev = "1311829cb73986ff8da4837e98a588860712630f" +rev = "069b3f6ee7499cdac84175946aeb9443d2578363" features = [ "__compat", "appservice-api-c", diff --git a/src/api/client/profile.rs b/src/api/client/profile.rs index 0b932944..1c487da4 100644 --- a/src/api/client/profile.rs +++ b/src/api/client/profile.rs @@ -273,7 +273,7 @@ pub(crate) async fn get_profile_route( ("avatar_url", response.avatar_url.map(Into::into)), ("blurhash", response.blurhash), ("displayname", response.displayname), - ("tz", response.tz), + ("m.tz", response.tz), ]; let response = canonical_fields @@ -314,7 +314,7 @@ pub(crate) async fn get_profile_route( ("avatar_url", avatar_url.map(Into::into)), ("blurhash", blurhash), ("displayname", displayname), - ("tz", tz), + ("m.tz", tz), ]; let response = canonical_fields diff --git a/src/api/client/unversioned.rs b/src/api/client/unversioned.rs index d77488f0..baad46e0 100644 --- a/src/api/client/unversioned.rs +++ b/src/api/client/unversioned.rs @@ -39,6 +39,8 @@ pub(crate) async fn get_supported_versions_route( "v1.5".to_owned(), "v1.10".to_owned(), // relations recursion "v1.11".to_owned(), // authenticated media + "v1.12".to_owned(), // m.tz + "v1.15".to_owned(), // custom profile fields ], unstable_features: BTreeMap::from_iter([ ("org.matrix.e2e_cross_signing".to_owned(), true), diff --git a/src/service/users/profile.rs b/src/service/users/profile.rs index 0c69f0ea..b8467f84 100644 --- a/src/service/users/profile.rs +++ b/src/service/users/profile.rs @@ -186,8 +186,7 @@ pub async fn blurhash(&self, user_id: &UserId) -> Result { /// Sets a new timezone or removes it if timezone is None. #[implement(super::Service)] pub fn set_timezone(&self, user_id: &UserId, timezone: Option<&str>) { - // TODO: insert to the stable MSC4175 key when it's stable - let key = (user_id, "us.cloke.msc4175.tz"); + let key = (user_id, "m.tz"); if let Some(timezone) = timezone { self.db @@ -201,16 +200,13 @@ pub fn set_timezone(&self, user_id: &UserId, timezone: Option<&str>) { /// Get the timezone of a user. #[implement(super::Service)] pub async fn timezone(&self, user_id: &UserId) -> Result { - // TODO: transparently migrate unstable key usage to the stable key once MSC4133 - // and MSC4175 are stable, likely a remove/insert in this block. - - // first check the unstable prefix then check the stable prefix - let unstable_key = (user_id, "us.cloke.msc4175.tz"); + //TODO: remove unstable key eventually. let stable_key = (user_id, "m.tz"); + let unstable_key = (user_id, "us.cloke.msc4175.tz"); self.db .useridprofilekey_value - .qry(&unstable_key) - .or_else(|_| self.db.useridprofilekey_value.qry(&stable_key)) + .qry(&stable_key) + .or_else(|_| self.db.useridprofilekey_value.qry(&unstable_key)) .await .deserialized() }