Check the room_types
filter when searching for local public rooms (#698)
This commit is contained in:
parent
1e23c95ec6
commit
1366a3092f
1 changed files with 4 additions and 1 deletions
|
@ -15,7 +15,7 @@ use ruma::{
|
||||||
},
|
},
|
||||||
federation,
|
federation,
|
||||||
},
|
},
|
||||||
directory::{Filter, PublicRoomJoinRule, PublicRoomsChunk, RoomNetwork},
|
directory::{Filter, PublicRoomJoinRule, PublicRoomsChunk, RoomNetwork, RoomTypeFilter},
|
||||||
events::{
|
events::{
|
||||||
StateEventType,
|
StateEventType,
|
||||||
room::{
|
room::{
|
||||||
|
@ -289,6 +289,9 @@ pub(crate) async fn get_public_rooms_filtered_helper(
|
||||||
.map(ToOwned::to_owned)
|
.map(ToOwned::to_owned)
|
||||||
.then(|room_id| public_rooms_chunk(services, room_id))
|
.then(|room_id| public_rooms_chunk(services, room_id))
|
||||||
.filter_map(|chunk| async move {
|
.filter_map(|chunk| async move {
|
||||||
|
if !filter.room_types.is_empty() && !filter.room_types.contains(&RoomTypeFilter::from(chunk.room_type.clone())) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
if let Some(query) = filter.generic_search_term.as_ref().map(|q| q.to_lowercase()) {
|
if let Some(query) = filter.generic_search_term.as_ref().map(|q| q.to_lowercase()) {
|
||||||
if let Some(name) = &chunk.name {
|
if let Some(name) = &chunk.name {
|
||||||
if name.as_str().to_lowercase().contains(&query) {
|
if name.as_str().to_lowercase().contains(&query) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue