mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-10-22 14:21:19 +00:00
fix: Apply ignore filtering to peeking route
Reviewed-By: Jade Ellis <jade@ellis.link>
This commit is contained in:
1 file changed
+18
-5
@@ -2,15 +2,21 @@
|
||||
use conduwuit::{
|
||||
Err, Event, Result, at, debug_warn,
|
||||
result::LogErr,
|
||||
utils::{BoolExt, stream::TryTools},
|
||||
utils::{
|
||||
BoolExt,
|
||||
stream::{TryIgnore, WidebandExt},
|
||||
},
|
||||
};
|
||||
use futures::{FutureExt, TryStreamExt, future::try_join4};
|
||||
use futures::{FutureExt, StreamExt, TryStreamExt, future::try_join4};
|
||||
use ruma::{
|
||||
api::client::peeking::get_current_state::v3::{PaginationChunk, Request, Response},
|
||||
assign,
|
||||
};
|
||||
|
||||
use crate::Ruma;
|
||||
use crate::{
|
||||
Ruma,
|
||||
client::{ignored_filter, visibility_filter},
|
||||
};
|
||||
|
||||
const LIMIT_MAX: usize = 100;
|
||||
|
||||
@@ -52,8 +58,11 @@ pub(crate) async fn room_initial_sync_route(
|
||||
.rooms
|
||||
.timeline
|
||||
.pdus_rev(room_id, None)
|
||||
.try_take(limit)
|
||||
.and_then(async |mut pdu| {
|
||||
.ignore_err()
|
||||
.wide_filter_map(|item| ignored_filter(&services, item, sender_user))
|
||||
.wide_filter_map(|item| visibility_filter(&services, item, sender_user))
|
||||
.take(limit)
|
||||
.wide_then(async |mut pdu| {
|
||||
let ctx = services
|
||||
.rooms
|
||||
.timeline
|
||||
@@ -77,6 +86,10 @@ pub(crate) async fn room_initial_sync_route(
|
||||
.boxed()
|
||||
.await?;
|
||||
|
||||
if events.is_empty() {
|
||||
return Ok(Response::new(room_id.to_owned()));
|
||||
}
|
||||
|
||||
let end = events
|
||||
.first()
|
||||
.map(at!(0))
|
||||
|
||||
Reference in new issue
Block a user