Merge branch 'restricted' into 'next'

fix: restricted room error is now FORBIDDEN

See merge request famedly/conduit!478
This commit is contained in:
Timo Kösters 2023-06-08 18:52:03 +00:00
commit 808b12f618
2 changed files with 10 additions and 3 deletions

View file

@ -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"
);

View file

@ -108,7 +108,7 @@ pub async fn login_route(body: Ruma<login::v3::Request>) -> Result<login::v3::Re
if !body.from_appservice {
return Err(Error::BadRequest(
ErrorKind::Forbidden,
"Forbidden login type."
"Forbidden login type.",
));
};
let username = if let UserIdentifier::UserIdOrLocalpart(user_id) = identifier {