Skip to content

Commit

Permalink
fix: find all view ids to be filtered
Browse files Browse the repository at this point in the history
  • Loading branch information
Xazin committed Jul 14, 2024
1 parent 2605a84 commit 28aa392
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 41 deletions.
7 changes: 0 additions & 7 deletions frontend/appflowy_tauri/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions frontend/appflowy_tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]

[patch.crates-io]
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab = { path = "../../AppFlowy-Collab/collab" }
collab-entity = { path = "../../AppFlowy-Collab/collab-entity" }
collab-folder = { path = "../../AppFlowy-Collab/collab-folder" }
collab-document = { path = "../../AppFlowy-Collab/collab-document" }
collab-database = { path = "../../AppFlowy-Collab/collab-database" }
collab-plugins = { path = "../../AppFlowy-Collab/collab-plugins" }
collab-user = { path = "../../AppFlowy-Collab/collab-user" }
15 changes: 8 additions & 7 deletions frontend/appflowy_web/wasm-libs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions frontend/rust-lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions frontend/rust-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ rocksdb = { git = "https://github.com/LucasXu0/rust-rocksdb", rev = "21cf4a23ec1
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab = { path = "../AppFlowy-Collab/collab" }
collab-entity = { path = "../AppFlowy-Collab/collab-entity" }
collab-folder = { path = "../AppFlowy-Collab/collab-folder" }
collab-document = { path = "../AppFlowy-Collab/collab-document" }
collab-database = { path = "../AppFlowy-Collab/collab-database" }
collab-plugins = { path = "../AppFlowy-Collab/collab-plugins" }
collab-user = { path = "../AppFlowy-Collab/collab-user" }
1 change: 1 addition & 0 deletions frontend/rust-lib/flowy-folder/src/user_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl DefaultFolderBuilder {
recent: Default::default(),
trash: Default::default(),
private: Default::default(),
section_view_relations: Default::default(),
}
}
}
Expand Down
20 changes: 14 additions & 6 deletions frontend/rust-lib/flowy-search/src/services/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ impl SearchManager {
return;
},
};
let private_views = self.folder_manager.get_view_ids_should_be_filtered(folder);
tracing::warn!("Private views: {:?}", private_views);

let private_space_ids = self.folder_manager.get_view_ids_should_be_filtered(folder);

let max: usize = self.handlers.len();
let handlers = self.handlers.clone();
Expand All @@ -96,17 +96,25 @@ impl SearchManager {
let f = filter.clone();
let ch = channel.clone();
let notifier = self.notifier.clone();
let private_view_ids = private_views.clone();

let filtered_ids = private_space_ids
.iter()
.filter_map(|key| folder.section_view_relations.get(key))
.flatten()
.cloned()
.collect::<Vec<String>>();

af_spawn(async move {
let res = handler.perform_search(q.clone(), f).await;

let items = res.unwrap_or_default();

// Filter out any items which ID exists in private_views
tracing::warn!("Search Result: {:?}", items);
tracing::warn!("Filtered IDs: {:?}", filtered_ids);

// filter out items that are not in the private view
let items = items
.into_iter()
.filter(|item| !private_view_ids.contains(&item.id))
.filter(|item| !filtered_ids.contains(&item.id))
.collect();

let notification = SearchResultNotificationPB {
Expand Down

0 comments on commit 28aa392

Please sign in to comment.