mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 12:46:49 +00:00
style: Unchain if statement
This commit is contained in:
1 parent
6299df3552
commit
d1b1274900
1 file changed
+7
-11
@@ -17,18 +17,13 @@ pub(crate) async fn get_room_event_route(
|
||||
|
||||
let mut event = match services.rooms.timeline.get_pdu(event_id).await {
|
||||
| Ok(event) => event,
|
||||
| Err(_) => {
|
||||
| Err(e) if e.is_not_found() => {
|
||||
// Only fetch over federation for users who could see the event.
|
||||
if !services
|
||||
.rooms
|
||||
.state_cache
|
||||
.is_joined(sender_user, room_id)
|
||||
.await && !services
|
||||
.rooms
|
||||
.state_accessor
|
||||
.is_world_readable(room_id)
|
||||
.await
|
||||
{
|
||||
let (joined, world_readable) = tokio::join!(
|
||||
services.rooms.state_cache.is_joined(sender_user, room_id),
|
||||
services.rooms.state_accessor.is_world_readable(room_id)
|
||||
);
|
||||
if !joined && !world_readable {
|
||||
return Err!(Request(NotFound("Event {} not found.", event_id)));
|
||||
}
|
||||
|
||||
@@ -39,6 +34,7 @@ pub(crate) async fn get_room_event_route(
|
||||
.await
|
||||
.map_err(|_| err!(Request(NotFound("Event {} not found.", event_id))))?
|
||||
},
|
||||
| Err(e) => return Err(e),
|
||||
};
|
||||
|
||||
// NOTE: checked after fetching, as visibility of an unknown event cannot
|
||||
|
||||
Reference in new issue
Block a user