feat: Return SENDER_IGNORED error for context and relations

This commit is contained in:
timedout
2026-01-22 13:58:20 +00:00
committed by Jade Ellis
parent 8bc6e6ccca
commit f1ab27d344
2 changed files with 23 additions and 5 deletions
+13 -3
View File
@@ -1,6 +1,6 @@
use axum::extract::State;
use conduwuit::{
Err, Event, Result, at, debug_warn, err, ref_at,
Err, Error, Event, Result, at, debug_warn, err, ref_at,
utils::{
IterStream,
future::TryExtExt,
@@ -12,11 +12,18 @@ use futures::{
FutureExt, StreamExt, TryFutureExt, TryStreamExt,
future::{OptionFuture, join, join3, try_join3},
};
use ruma::{OwnedEventId, UserId, api::client::context::get_context, events::StateEventType};
use ruma::{
OwnedEventId, UserId,
api::client::{context::get_context, error::ErrorKind},
events::StateEventType,
};
use crate::{
Ruma,
client::message::{event_filter, ignored_filter, lazy_loading_witness, visibility_filter},
client::{
is_ignored_pdu,
message::{event_filter, ignored_filter, lazy_loading_witness, visibility_filter},
},
};
const LIMIT_MAX: usize = 100;
@@ -78,6 +85,9 @@ pub(crate) async fn get_context_route(
return Err!(Request(NotFound("Event not found.")));
}
// Return M_SENDER_IGNORED if the sender of base_event is ignored (MSC4406)
is_ignored_pdu(&services, &base_pdu, sender_user).await?;
let base_count = base_id.pdu_count();
let base_event = ignored_filter(&services, (base_count, base_pdu), sender_user);