diff --git a/src/api/client/context.rs b/src/api/client/context.rs index 51eba5d2..ddc4e6d3 100644 --- a/src/api/client/context.rs +++ b/src/api/client/context.rs @@ -1,6 +1,6 @@ use axum::extract::State; use conduwuit::{ - Err, Error, Event, Result, at, debug_warn, err, ref_at, + Err, Event, Result, at, debug_warn, err, ref_at, utils::{ IterStream, future::TryExtExt, @@ -12,11 +12,7 @@ use futures::{ FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::{OptionFuture, join, join3, try_join3}, }; -use ruma::{ - OwnedEventId, UserId, - api::client::{context::get_context, error::ErrorKind}, - events::StateEventType, -}; +use ruma::{OwnedEventId, UserId, api::client::context::get_context, events::StateEventType}; use crate::{ Ruma, diff --git a/src/api/client/relations.rs b/src/api/client/relations.rs index 0b32b9d0..baa5b668 100644 --- a/src/api/client/relations.rs +++ b/src/api/client/relations.rs @@ -167,6 +167,7 @@ async fn paginate_relations_with_filter( .ready_take_while(|(count, _)| Some(*count) != to) .take(limit) .wide_filter_map(|item| visibility_filter(services, sender_user, item)) + .wide_filter_map(|item| ignored_filter(services, item, sender_user)) .then(async |mut pdu| { if let Err(e) = services .rooms @@ -222,3 +223,17 @@ async fn visibility_filter( .await .then_some(item) } + +async fn ignored_filter( + services: &Services, + item: (PduCount, Pdu), + sender_user: &UserId, +) -> Option<(PduCount, Pdu)> { + let (_, pdu) = &item; + + if is_ignored_pdu(services, pdu, sender_user).await.ok()? { + None + } else { + Some(item) + } +}