refactor: Allow for client identities with no user ID

This commit is contained in:
Ginger committed 2026-05-27 12:15:16 -04:00
1 parent 30c9d6d2df
commit d7a51c7107
57 files changed
+212 -185

No files matched your search

+4 -4
View File
@@ -22,7 +22,7 @@ pub(crate) async fn set_global_account_data_route(
State(services): State<crate::State>,
body: Ruma<set_global_account_data::v3::Request>,
) -> Result<set_global_account_data::v3::Response> {
let sender_user = body.identity.sender_user();
let sender_user = body.identity.expect_sender_user()?;
if sender_user != body.user_id && !body.identity.is_appservice() {
return Err!(Request(Forbidden("You cannot set account data for other users.")));
@@ -47,7 +47,7 @@ pub(crate) async fn set_room_account_data_route(
State(services): State<crate::State>,
body: Ruma<set_room_account_data::v3::Request>,
) -> Result<set_room_account_data::v3::Response> {
let sender_user = body.identity.sender_user();
let sender_user = body.identity.expect_sender_user()?;
if sender_user != body.user_id && !body.identity.is_appservice() {
return Err!(Request(Forbidden("You cannot set account data for other users.")));
@@ -72,7 +72,7 @@ pub(crate) async fn get_global_account_data_route(
State(services): State<crate::State>,
body: Ruma<get_global_account_data::v3::Request>,
) -> Result<get_global_account_data::v3::Response> {
let sender_user = body.identity.sender_user();
let sender_user = body.identity.expect_sender_user()?;
if sender_user != body.user_id && !body.identity.is_appservice() {
return Err!(Request(Forbidden("You cannot get account data of other users.")));
@@ -94,7 +94,7 @@ pub(crate) async fn get_room_account_data_route(
State(services): State<crate::State>,
body: Ruma<get_room_account_data::v3::Request>,
) -> Result<get_room_account_data::v3::Response> {
let sender_user = body.identity.sender_user();
let sender_user = body.identity.expect_sender_user()?;
if sender_user != body.user_id && !body.identity.is_appservice() {
return Err!(Request(Forbidden("You cannot get account data of other users.")));