drop redacted events from search results

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
Benjamin Lee 2024-06-12 00:36:38 -04:00 committed by June 🍓🦴
parent eb73d8c669
commit 0688a96c37
2 changed files with 24 additions and 5 deletions

View file

@ -141,11 +141,12 @@ pub(crate) async fn search_events_route(body: Ruma<search_events::v3::Request>)
.get_pdu_from_id(result)
.ok()?
.filter(|pdu| {
services()
.rooms
.state_accessor
.user_can_see_event(sender_user, &pdu.room_id, &pdu.event_id)
.unwrap_or(false)
!pdu.is_redacted()
&& services()
.rooms
.state_accessor
.user_can_see_event(sender_user, &pdu.room_id, &pdu.event_id)
.unwrap_or(false)
})
.map(|pdu| pdu.to_room_event())
})