From a5176e64f6e3ac83fc779524d6c980028bf72939 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 12:48:11 +0000 Subject: [PATCH] Trust settings sync as a collab project client (#46700) (cherry-pick to preview) (#46702) Cherry-pick of #46700 to preview ---- Collab projects are considered trusted and remote clients use the editor-related settings only. A better fix would be sync "not trusted" indicator with the project host, and disallow clients' iteraction with that indicator. Release Notes: - Fixed collab settings sync causing "not trusted" pop ups for client Co-authored-by: Kirill Bulatov --- crates/project/src/project.rs | 2 ++ crates/project/src/project_settings.rs | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 818909f90f030857bfbbdd9e754f6cad6aec56f7..cb2a59e282facd34859f5999c9c73d43f48b978f 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -1353,6 +1353,7 @@ impl Project { worktree_store.clone(), task_store.clone(), Some(remote_proto.clone()), + false, cx, ) }); @@ -1648,6 +1649,7 @@ impl Project { worktree_store.clone(), task_store.clone(), None, + true, cx, ) })?; diff --git a/crates/project/src/project_settings.rs b/crates/project/src/project_settings.rs index 50a2b675d282ee5a5549082fceadaa2bf49e8d51..187cfaf224796ef015687ee8a5d4b42e6b701a37 100644 --- a/crates/project/src/project_settings.rs +++ b/crates/project/src/project_settings.rs @@ -618,7 +618,7 @@ impl Settings for ProjectSettings { pub enum SettingsObserverMode { Local(Arc), - Remote, + Remote { via_collab: bool }, } #[derive(Clone, Debug, PartialEq)] @@ -739,6 +739,7 @@ impl SettingsObserver { worktree_store: Entity, task_store: Entity, upstream_client: Option, + via_collab: bool, cx: &mut Context, ) -> Self { let mut user_settings_watcher = None; @@ -768,7 +769,7 @@ impl SettingsObserver { Self { worktree_store, task_store, - mode: SettingsObserverMode::Remote, + mode: SettingsObserverMode::Remote { via_collab }, downstream_client: None, project_id: REMOTE_SERVER_PROJECT_ID, _trusted_worktrees_watcher: None, @@ -845,6 +846,10 @@ impl SettingsObserver { }; let path = RelPath::from_proto(&envelope.payload.path)?; this.update(&mut cx, |this, cx| { + let is_via_collab = match &this.mode { + SettingsObserverMode::Local(..) => false, + SettingsObserverMode::Remote { via_collab } => *via_collab, + }; let worktree_id = WorktreeId::from_proto(envelope.payload.worktree_id); let Some(worktree) = this .worktree_store @@ -861,6 +866,7 @@ impl SettingsObserver { local_settings_kind_from_proto(kind), envelope.payload.content, )], + is_via_collab, cx, ); })?; @@ -1054,6 +1060,7 @@ impl SettingsObserver { settings_contents.into_iter().map(|(path, kind, content)| { (path, kind, content.and_then(|c| c.log_err())) }), + false, cx, ) }) @@ -1066,12 +1073,17 @@ impl SettingsObserver { &mut self, worktree: Entity, settings_contents: impl IntoIterator, LocalSettingsKind, Option)>, + is_via_collab: bool, cx: &mut Context, ) { let worktree_id = worktree.read(cx).id(); let remote_worktree_id = worktree.read(cx).id(); let task_store = self.task_store.clone(); - let can_trust_worktree = OnceCell::new(); + let can_trust_worktree = if is_via_collab { + OnceCell::from(true) + } else { + OnceCell::new() + }; for (directory, kind, file_content) in settings_contents { let mut applied = true; match kind {