diff --git a/crates/project/src/worktree_store.rs b/crates/project/src/worktree_store.rs index 8e18a8085dd311d8e5c34da783dc720570553bc5..db86dfb8c2984c2e933279b152e3ec501537d3ab 100644 --- a/crates/project/src/worktree_store.rs +++ b/crates/project/src/worktree_store.rs @@ -5,7 +5,7 @@ use std::{ sync::{Arc, atomic::AtomicUsize}, }; -use anyhow::{Context as _, Result, anyhow}; +use anyhow::{Context as _, Result, anyhow, bail}; use collections::{HashMap, HashSet}; use fs::{Fs, copy_recursive}; use futures::{ @@ -1194,6 +1194,16 @@ impl WorktreeStore { RelPath::from_proto(&envelope.payload.new_path)?, ); let (scan_id, entry) = this.update(&mut cx, |this, cx| { + let Some((_, project_id)) = this.downstream_client else { + bail!("no downstream client") + }; + let Some(entry) = this.entry_for_id(entry_id, cx) else { + bail!("no such entry"); + }; + if entry.is_private && project_id != REMOTE_SERVER_PROJECT_ID { + bail!("entry is private") + } + let new_worktree = this .worktree_for_id(new_worktree_id, cx) .context("no such worktree")?; @@ -1217,6 +1227,15 @@ impl WorktreeStore { ) -> Result { let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id); let worktree = this.update(&mut cx, |this, cx| { + let Some((_, project_id)) = this.downstream_client else { + bail!("no downstream client") + }; + let Some(entry) = this.entry_for_id(entry_id, cx) else { + bail!("no entry") + }; + if entry.is_private && project_id != REMOTE_SERVER_PROJECT_ID { + bail!("entry is private") + } this.worktree_for_entry(entry_id, cx) .context("worktree not found") })??; @@ -1237,6 +1256,18 @@ impl WorktreeStore { let worktree = this .worktree_for_entry(entry_id, cx) .context("no such worktree")?; + + let Some((_, project_id)) = this.downstream_client else { + bail!("no downstream client") + }; + let entry = worktree + .read(cx) + .entry_for_id(entry_id) + .ok_or_else(|| anyhow!("missing entry"))?; + if entry.is_private && project_id != REMOTE_SERVER_PROJECT_ID { + bail!("entry is private") + } + let scan_id = worktree.read(cx).scan_id(); anyhow::Ok(( scan_id, diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index aac3769ac4ed3def5dfd427fe13885176fd43047..81d9ee6099c99f93872ddfaec8d499c4d866e308 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -64,7 +64,7 @@ use workspace::{ DraggedSelection, OpenInTerminal, OpenOptions, OpenVisible, PreviewTabsSettings, SelectedEntry, SplitDirection, Workspace, dock::{DockPosition, Panel, PanelEvent}, - notifications::{DetachAndPromptErr, NotifyTaskExt}, + notifications::{DetachAndPromptErr, NotifyResultExt, NotifyTaskExt}, }; use worktree::CreatedEntry; use zed_actions::workspace::OpenWithSystem; @@ -2677,12 +2677,14 @@ impl ProjectPanel { for task in paste_tasks { match task { PasteTask::Rename(task) => { - if let Some(CreatedEntry::Included(entry)) = task.await.log_err() { + if let Some(CreatedEntry::Included(entry)) = + task.await.notify_async_err(cx) + { last_succeed = Some(entry); } } PasteTask::Copy(task) => { - if let Some(Some(entry)) = task.await.log_err() { + if let Some(Some(entry)) = task.await.notify_async_err(cx) { last_succeed = Some(entry); } }