mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix: Call user_may_join_room later in the join process
This commit is contained in:
@@ -79,26 +79,6 @@ pub(crate) async fn join_room_by_id_route(
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if let Err(e) = services
|
|
||||||
.antispam
|
|
||||||
.user_may_join_room(
|
|
||||||
sender_user.to_owned(),
|
|
||||||
body.room_id.clone(),
|
|
||||||
services
|
|
||||||
.rooms
|
|
||||||
.state_cache
|
|
||||||
.is_invited(sender_user, &body.room_id)
|
|
||||||
.await,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
warn!(
|
|
||||||
"Antispam prevented user {} from joining room {}: {}",
|
|
||||||
sender_user, body.room_id, e
|
|
||||||
);
|
|
||||||
return Err!(Request(Forbidden("You are not allowed to join this room.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
// There is no body.server_name for /roomId/join
|
// There is no body.server_name for /roomId/join
|
||||||
let mut servers: Vec<_> = services
|
let mut servers: Vec<_> = services
|
||||||
.rooms
|
.rooms
|
||||||
@@ -308,6 +288,23 @@ pub async fn join_room_by_id_helper(
|
|||||||
return Ok(join_room_by_id::v3::Response { room_id: room_id.into() });
|
return Ok(join_room_by_id::v3::Response { room_id: room_id.into() });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Err(e) = services
|
||||||
|
.antispam
|
||||||
|
.user_may_join_room(
|
||||||
|
sender_user.to_owned(),
|
||||||
|
room_id.to_owned(),
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.is_invited(sender_user, room_id)
|
||||||
|
.await,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
warn!("Antispam prevented user {} from joining room {}: {}", sender_user, room_id, e);
|
||||||
|
return Err!(Request(Forbidden("You are not allowed to join this room.")));
|
||||||
|
}
|
||||||
|
|
||||||
let server_in_room = services
|
let server_in_room = services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
|
|||||||
Reference in New Issue
Block a user