fix: do not return redacted events from search

This commit is contained in:
Benjamin Lee 2024-06-11 16:33:55 +02:00 committed by Timo Kösters
parent 48c1f3bdba
commit 7b259272ce
No known key found for this signature in database
GPG key ID: 0B25E636FBA7E4CB
6 changed files with 92 additions and 25 deletions

View file

@ -89,11 +89,12 @@ pub async fn search_events_route(
.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())
})