From 1ea27c4f97bfc717f9753d8bbd91eafa395cdd2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Thu, 8 Jun 2023 20:48:35 +0200 Subject: [PATCH] fix: restricted room error is now FORBIDDEN --- src/api/client_server/membership.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/api/client_server/membership.rs b/src/api/client_server/membership.rs index cd26372d..11e37e62 100644 --- a/src/api/client_server/membership.rs +++ b/src/api/client_server/membership.rs @@ -106,6 +106,7 @@ pub async fn join_room_by_id_or_alias_route( ); servers.push(room_id.server_name().to_owned()); + (servers, room_id) } Err(room_alias) => { @@ -598,7 +599,7 @@ async fn join_room_by_id_helper( info!("send_join finished"); if let Some(signed_raw) = &send_join_response.room_state.event { - info!("There is a signed event. This room is probably using restricted joins"); + info!("There is a signed event. This room is probably using restricted joins. Adding signature to our event"); let (signed_event_id, signed_value) = match gen_event_id_canonical_json(signed_raw, &room_version_id) { Ok(t) => t, @@ -901,7 +902,13 @@ async fn join_room_by_id_helper( Err(e) => e, }; - if !restriction_rooms.is_empty() { + if !restriction_rooms.is_empty() + && servers + .iter() + .filter(|s| *s != services().globals.server_name()) + .count() + > 0 + { info!( "We couldn't do the join locally, maybe federation can help to satisfy the restricted join requirements" );