fix: hide space without any published documents, allow private published

collab
This commit is contained in:
khorshuheng 2024-09-06 11:02:53 +08:00
parent bfc8b0db58
commit df14ecbfbd
1 changed files with 2 additions and 5 deletions

View File

@ -4,16 +4,13 @@ use app_error::AppError;
use collab_folder::Folder; use collab_folder::Folder;
use shared_entity::dto::workspace_dto::PublishedView; use shared_entity::dto::workspace_dto::PublishedView;
use super::folder_view::{to_dto_view_icon, to_view_layout, view_is_space}; use super::folder_view::{to_dto_view_icon, to_view_layout};
pub fn collab_folder_to_published_outline( pub fn collab_folder_to_published_outline(
folder: &Folder, folder: &Folder,
publish_view_ids: &HashSet<String>, publish_view_ids: &HashSet<String>,
) -> Result<PublishedView, AppError> { ) -> Result<PublishedView, AppError> {
let mut unviewable = HashSet::new(); let mut unviewable = HashSet::new();
for private_section in folder.get_all_private_sections() {
unviewable.insert(private_section.id);
}
for trash_view in folder.get_all_trash_sections() { for trash_view in folder.get_all_trash_sections() {
unviewable.insert(trash_view.id); unviewable.insert(trash_view.id);
} }
@ -117,7 +114,7 @@ fn to_publish_view(
}) })
.collect(); .collect();
let is_published = publish_view_ids.contains(view_id); let is_published = publish_view_ids.contains(view_id);
if view_is_space(&view) || is_published || !pruned_view.is_empty() { if is_published || !pruned_view.is_empty() {
Some(PublishedView { Some(PublishedView {
view_id: view.id.clone(), view_id: view.id.clone(),
name: view.name.clone(), name: view.name.clone(),