fix(fed): dont reject /backfill/ on world readable rooms

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-06-07 01:45:00 -04:00
parent 81487e3f07
commit 8103bd7310

View file

@ -12,19 +12,23 @@ use crate::{services, Error, PduEvent, Result, Ruma};
pub(crate) async fn get_backfill_route(body: Ruma<get_backfill::v1::Request>) -> Result<get_backfill::v1::Response> {
let origin = body.origin.as_ref().expect("server is authenticated");
if !services()
.rooms
.state_cache
.server_in_room(origin, &body.room_id)?
{
return Err(Error::BadRequest(ErrorKind::forbidden(), "Server is not in room."));
}
services()
.rooms
.event_handler
.acl_check(origin, &body.room_id)?;
if !services()
.rooms
.state_accessor
.is_world_readable(&body.room_id)?
&& !services()
.rooms
.state_cache
.server_in_room(origin, &body.room_id)?
{
return Err(Error::BadRequest(ErrorKind::forbidden(), "Server is not in room."));
}
let until = body
.v
.iter()