Add a setting to prevent sharing projects in public channels (#41395)

This PR adds a setting to prevent projects from being shared in public
channels.

This can be enabled by adding the following to the project settings
(`.zed/settings.json`):

```json
{
  "prevent_sharing_in_public_channels": true
}
```

This will then disable the "Share" button when not in a private channel:

<img width="380" height="115" alt="Screenshot 2025-10-28 at 2 28 10 PM"
src="https://github.com/user-attachments/assets/6761ac34-c0d5-4451-a443-adf7a1c42bcd"
/>

Release Notes:

- collaboration: Added a `prevent_sharing_in_public_channels` project
setting for preventing projects from being shared in public channels.
This commit is contained in:
Marshall Bowers
2025-10-28 18:48:07 +00:00
committed by GitHub
parent 1f5101d9fd
commit e604ef3af9
6 changed files with 40 additions and 0 deletions
@@ -64,6 +64,12 @@ pub struct WorktreeSettingsContent {
#[serde(skip_serializing_if = "Maybe::is_unset")]
pub project_name: Maybe<String>,
/// Whether to prevent this project from being shared in public channels.
///
/// Default: false
#[serde(default)]
pub prevent_sharing_in_public_channels: bool,
/// Completely ignore files matching globs from `file_scan_exclusions`. Overrides
/// `file_scan_inclusions`.
///
+1
View File
@@ -855,6 +855,7 @@ impl VsCodeSettings {
fn worktree_settings_content(&self) -> WorktreeSettingsContent {
WorktreeSettingsContent {
project_name: crate::Maybe::Unset,
prevent_sharing_in_public_channels: false,
file_scan_exclusions: self
.read_value("files.watcherExclude")
.and_then(|v| v.as_array())