check if we know about room at /make_leave

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-05-26 16:36:00 -04:00 committed by June 🍓🦴
parent 826edc0a3a
commit 0256c27363
1 changed files with 4 additions and 0 deletions

View File

@ -1365,6 +1365,10 @@ pub(crate) async fn create_join_event_v2_route(
pub(crate) async fn create_leave_event_template_route(
body: Ruma<prepare_leave_event::v1::Request>,
) -> Result<prepare_leave_event::v1::Response> {
if !services().rooms.metadata.exists(&body.room_id)? {
return Err(Error::BadRequest(ErrorKind::NotFound, "Room is unknown to this server."));
}
let origin = body.origin.as_ref().expect("server is authenticated");
// ACL check origin