fix dropped events in search
The previous code would drop some events entirely if any events between `skip` and `skip + limit` were not visible to the user. This would cause the set of events skipped by the `skip(skip)` method to extend past `skip` in the raw result set, because `skip(skip)` was being called *after* filtering out invisible events. This bug will become much more severe with a full filtering implementation, because it will be more likely for events to be filtered out. Currently, it is only possible to trigger with rooms that have history visibility set to "invited" or "joined". Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
73da353e52
commit
81cd677b4e
1 changed files with 1 additions and 1 deletions
|
@ -133,6 +133,7 @@ pub(crate) async fn search_events_route(body: Ruma<search_events::v3::Request>)
|
|||
|
||||
let results: Vec<_> = results
|
||||
.iter()
|
||||
.skip(skip)
|
||||
.filter_map(|result| {
|
||||
services()
|
||||
.rooms
|
||||
|
@ -162,7 +163,6 @@ pub(crate) async fn search_events_route(body: Ruma<search_events::v3::Request>)
|
|||
})
|
||||
})
|
||||
.filter_map(Result::ok)
|
||||
.skip(skip)
|
||||
.take(limit)
|
||||
.collect();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue