mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-03 21:45:51 -04:00
chore(ui): Remove the all room list filter.
This patch removes the `all` room list filter. It's not used anymore since we have `non_left` which is more correct.
This commit is contained in:
@@ -14,7 +14,7 @@ use matrix_sdk::{
|
||||
};
|
||||
use matrix_sdk_ui::{
|
||||
room_list_service::filters::{
|
||||
new_filter_all, new_filter_fuzzy_match_room_name, new_filter_non_left, new_filter_none,
|
||||
new_filter_fuzzy_match_room_name, new_filter_non_left, new_filter_none,
|
||||
new_filter_normalized_match_room_name,
|
||||
},
|
||||
timeline::default_event_filter,
|
||||
@@ -394,7 +394,6 @@ impl RoomListDynamicEntriesController {
|
||||
use RoomListEntriesDynamicFilterKind as Kind;
|
||||
|
||||
match kind {
|
||||
Kind::All => self.inner.set_filter(new_filter_all()),
|
||||
Kind::NonLeft => self.inner.set_filter(new_filter_non_left(&self.client)),
|
||||
Kind::None => self.inner.set_filter(new_filter_none()),
|
||||
Kind::NormalizedMatchRoomName { pattern } => {
|
||||
@@ -417,7 +416,6 @@ impl RoomListDynamicEntriesController {
|
||||
|
||||
#[derive(uniffi::Enum)]
|
||||
pub enum RoomListEntriesDynamicFilterKind {
|
||||
All,
|
||||
NonLeft,
|
||||
None,
|
||||
NormalizedMatchRoomName { pattern: String },
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
use matrix_sdk::RoomListEntry;
|
||||
|
||||
use super::Filter;
|
||||
|
||||
/// Create a new filter that will accept all filled or invalidated entries.
|
||||
pub fn new_filter() -> impl Filter {
|
||||
|room_list_entry| -> bool {
|
||||
matches!(room_list_entry, RoomListEntry::Filled(_) | RoomListEntry::Invalidated(_))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::ops::Not;
|
||||
|
||||
use matrix_sdk::RoomListEntry;
|
||||
use ruma::room_id;
|
||||
|
||||
use super::new_filter;
|
||||
|
||||
#[test]
|
||||
fn test_all_kind_of_room_list_entry() {
|
||||
let all = new_filter();
|
||||
|
||||
assert!(all(&RoomListEntry::Empty).not());
|
||||
assert!(all(&RoomListEntry::Filled(room_id!("!r0:bar.org").to_owned())));
|
||||
assert!(all(&RoomListEntry::Invalidated(room_id!("!r0:bar.org").to_owned())));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
mod all;
|
||||
mod fuzzy_match_room_name;
|
||||
mod logical_all;
|
||||
mod logical_any;
|
||||
@@ -7,7 +6,6 @@ mod non_left;
|
||||
mod none;
|
||||
mod normalized_match_room_name;
|
||||
|
||||
pub use all::new_filter as new_filter_all;
|
||||
pub use fuzzy_match_room_name::new_filter as new_filter_fuzzy_match_room_name;
|
||||
pub use logical_all::new_filter as new_filter_logical_all;
|
||||
pub use logical_any::new_filter as new_filter_logical_any;
|
||||
|
||||
@@ -12,7 +12,7 @@ use matrix_sdk_base::sync::UnreadNotificationsCount;
|
||||
use matrix_sdk_test::async_test;
|
||||
use matrix_sdk_ui::{
|
||||
room_list_service::{
|
||||
filters::{new_filter_all, new_filter_fuzzy_match_room_name, new_filter_none},
|
||||
filters::{new_filter_fuzzy_match_room_name, new_filter_non_left, new_filter_none},
|
||||
Error, Input, InputResult, RoomListEntry, RoomListLoadingState, State, SyncIndicator,
|
||||
ALL_ROOMS_LIST_NAME as ALL_ROOMS, INVITES_LIST_NAME as INVITES,
|
||||
VISIBLE_ROOMS_LIST_NAME as VISIBLE_ROOMS,
|
||||
@@ -1822,7 +1822,7 @@ async fn test_dynamic_entries_stream() -> Result<(), Error> {
|
||||
};
|
||||
|
||||
// Now, let's change again the dynamic filter!
|
||||
dynamic_entries.set_filter(new_filter_all());
|
||||
dynamic_entries.set_filter(new_filter_non_left(&client));
|
||||
|
||||
// Assert the dynamic entries.
|
||||
assert_entries_batch! {
|
||||
|
||||
Reference in New Issue
Block a user