fix sliding sync room type filter regression
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
ba683cf534
commit
9eace1fbbb
1 changed files with 17 additions and 12 deletions
|
@ -6,7 +6,9 @@ use std::{
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduit::{
|
use conduit::{
|
||||||
debug, err, error, is_equal_to,
|
debug, err, error,
|
||||||
|
error::is_not_found,
|
||||||
|
is_equal_to,
|
||||||
result::IntoIsOk,
|
result::IntoIsOk,
|
||||||
utils::{
|
utils::{
|
||||||
math::{ruma_from_u64, ruma_from_usize, usize_from_ruma, usize_from_u64_truncated},
|
math::{ruma_from_u64, ruma_from_usize, usize_from_ruma, usize_from_u64_truncated},
|
||||||
|
@ -1887,18 +1889,21 @@ async fn filter_rooms(
|
||||||
.iter()
|
.iter()
|
||||||
.stream()
|
.stream()
|
||||||
.filter_map(|r| async move {
|
.filter_map(|r| async move {
|
||||||
match services.rooms.state_accessor.get_room_type(r).await {
|
let room_type = services.rooms.state_accessor.get_room_type(r).await;
|
||||||
Err(_) => false,
|
|
||||||
Ok(result) => {
|
if room_type.as_ref().is_err_and(|e| !is_not_found(e)) {
|
||||||
let result = RoomTypeFilter::from(Some(result));
|
return None;
|
||||||
if negate {
|
}
|
||||||
!filter.contains(&result)
|
|
||||||
|
let room_type_filter = RoomTypeFilter::from(room_type.ok());
|
||||||
|
|
||||||
|
let include = if negate {
|
||||||
|
!filter.contains(&room_type_filter)
|
||||||
} else {
|
} else {
|
||||||
filter.is_empty() || filter.contains(&result)
|
filter.is_empty() || filter.contains(&room_type_filter)
|
||||||
}
|
};
|
||||||
},
|
|
||||||
}
|
include.then_some(r.to_owned())
|
||||||
.then_some(r.to_owned())
|
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue