fix(fed): dont reject /state/
on world readable rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
d10bc67c9d
commit
10dfbf6420
1 changed files with 13 additions and 9 deletions
|
@ -6,13 +6,22 @@ use crate::{services, Error, PduEvent, Result, Ruma};
|
|||
|
||||
/// # `GET /_matrix/federation/v1/state/{roomId}`
|
||||
///
|
||||
/// Retrieves the current state of the room.
|
||||
/// Retrieves a snapshot of a room's state at a given event.
|
||||
pub(crate) async fn get_room_state_route(
|
||||
body: Ruma<get_room_state::v1::Request>,
|
||||
) -> Result<get_room_state::v1::Response> {
|
||||
let origin = body.origin.as_ref().expect("server is authenticated");
|
||||
|
||||
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)?
|
||||
|
@ -20,11 +29,6 @@ pub(crate) async fn get_room_state_route(
|
|||
return Err(Error::BadRequest(ErrorKind::forbidden(), "Server is not in room."));
|
||||
}
|
||||
|
||||
services()
|
||||
.rooms
|
||||
.event_handler
|
||||
.acl_check(origin, &body.room_id)?;
|
||||
|
||||
let shortstatehash = services()
|
||||
.rooms
|
||||
.state_accessor
|
||||
|
|
Loading…
Add table
Reference in a new issue