fix: filter private views based on parent space (#860)

This commit is contained in:
Khor Shu Heng 2024-10-12 09:27:50 +08:00 committed by GitHub
parent 2f47d07593
commit ec2cc309bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 7 deletions

View File

@ -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);
@ -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,