Skip to content

Commit

Permalink
fix: filter private views based on parent space
Browse files Browse the repository at this point in the history
  • Loading branch information
khorshuheng committed Oct 11, 2024
1 parent 2f47d07 commit e6d6334
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/biz/collab/folder_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ pub fn collab_folder_to_folder_view(
pubished_view_ids: &HashSet<String>,
) -> Result<FolderView, AppError> {
let mut unviewable = HashSet::new();
for private_section in folder.get_all_private_sections() {
unviewable.insert(private_section.id);
}
let mut private_view_ids = HashSet::new();
let mut my_private_view_ids = HashSet::new();
for private_section in folder.get_my_private_sections() {
unviewable.remove(&private_section.id);
private_view_ids.insert(private_section.id);
my_private_view_ids.insert(private_section.id);
}
for private_section in folder.get_all_private_sections() {
if let Some(private_view) = folder.get_view(&private_section.id) {
if view_is_space(&private_view) && !my_private_view_ids.contains(&private_section.id) {
unviewable.insert(private_section.id);
}
}
}
for trash_view in folder.get_all_trash_sections() {
unviewable.insert(trash_view.id);
Expand All @@ -30,7 +33,7 @@ pub fn collab_folder_to_folder_view(
root_view_id,
folder,
&unviewable,
&private_view_ids,
&my_private_view_ids,
pubished_view_ids,
false,
0,
Expand Down

0 comments on commit e6d6334

Please sign in to comment.