diff --git a/src/api/client/relations.rs b/src/api/client/relations.rs index 265c003b..ec37b039 100644 --- a/src/api/client/relations.rs +++ b/src/api/client/relations.rs @@ -1,11 +1,11 @@ use axum::extract::State; use conduwuit::{ - Result, at, debug_warn, err, + Err, Result, at, debug_warn, matrix::{Event, event::RelationTypeEqual, pdu::PduCount}, utils::{IterStream, ReadyExt, result::FlatOk, stream::WidebandExt}, }; use conduwuit_service::Services; -use futures::{StreamExt, TryFutureExt}; +use futures::StreamExt; use ruma::{ EventId, RoomId, UInt, UserId, api::{ @@ -113,9 +113,10 @@ async fn paginate_relations_with_filter( .rooms .state_accessor .user_can_see_event(sender_user, room_id, target) + .await { debug_warn!(req_evt = ?target, ?room_id, "Event relations requested by {sender_user} but is not allowed to see it, returning 404"); - return err!(Request(NotFound("Event not found."))); + return Err!(Request(NotFound("Event not found."))); } let start: PduCount = from @@ -138,11 +139,6 @@ async fn paginate_relations_with_filter( // Spec (v1.10) recommends depth of at least 3 let depth: u8 = if recurse { 3 } else { 1 }; - // Check if this is a thread request - let is_thread = filter_rel_type - .as_ref() - .is_some_and(|rel| *rel == RelationType::Thread); - let events: Vec<_> = services .rooms .pdu_metadata diff --git a/src/api/client/search.rs b/src/api/client/search.rs index d6b78b6a..45e82376 100644 --- a/src/api/client/search.rs +++ b/src/api/client/search.rs @@ -50,7 +50,7 @@ pub(crate) async fn search_events_route( Ok(Response { search_categories: ResultCategories { - room_events: room_events_result + room_events: Box::pin(room_events_result) .await .unwrap_or_else(|| Ok(ResultRoomEvents::default()))?, },