Skip to content

Commit 5a9f825

Browse files
authored
collab_ui: Disable Collab panel based on organization configuration (#53567)
This PR makes it so the Collab panel can be disabled by the organization's configuration: <img width="239" height="191" alt="Screenshot 2026-04-09 at 2 38 35 PM" src="https://github.com/user-attachments/assets/48216c00-85cd-441a-b613-7468db2b25bd" /> Depends on zed-industries/cloud#2247. Closes CLO-638. Release Notes: - N/A
1 parent a151def commit 5a9f825

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

crates/cloud_api_types/src/cloud_api_types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub struct Organization {
5656
pub struct OrganizationConfiguration {
5757
pub is_zed_model_provider_enabled: bool,
5858
pub is_agent_thread_feedback_enabled: bool,
59+
pub is_collaboration_enabled: bool,
5960
pub edit_prediction: OrganizationEditPredictionConfiguration,
6061
}
6162

crates/collab_ui/src/collab_panel.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2620,6 +2620,18 @@ impl CollabPanel {
26202620
cx.write_to_clipboard(item)
26212621
}
26222622

2623+
fn render_disabled_by_organization(&mut self, _cx: &mut Context<Self>) -> Div {
2624+
v_flex()
2625+
.p_4()
2626+
.gap_4()
2627+
.size_full()
2628+
.text_center()
2629+
.justify_center()
2630+
.child(Label::new(
2631+
"Collaboration is disabled for this organization.",
2632+
))
2633+
}
2634+
26232635
fn render_signed_out(&mut self, cx: &mut Context<Self>) -> Div {
26242636
let collab_blurb = "Work with your team in realtime with collaborative editing, voice, shared notes and more.";
26252637

@@ -3645,6 +3657,12 @@ impl Render for CollabPanel {
36453657
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
36463658
let status = *self.client.status().borrow();
36473659

3660+
let is_collaboration_disabled = self
3661+
.user_store
3662+
.read(cx)
3663+
.current_organization_configuration()
3664+
.is_some_and(|config| !config.is_collaboration_enabled);
3665+
36483666
v_flex()
36493667
.key_context(self.dispatch_context(window, cx))
36503668
.on_action(cx.listener(CollabPanel::cancel))
@@ -3664,7 +3682,9 @@ impl Render for CollabPanel {
36643682
.on_action(cx.listener(CollabPanel::move_channel_down))
36653683
.track_focus(&self.focus_handle)
36663684
.size_full()
3667-
.child(if !status.is_or_was_connected() || status.is_signing_in() {
3685+
.child(if is_collaboration_disabled {
3686+
self.render_disabled_by_organization(cx)
3687+
} else if !status.is_or_was_connected() || status.is_signing_in() {
36683688
self.render_signed_out(cx)
36693689
} else {
36703690
self.render_signed_in(window, cx)

0 commit comments

Comments
 (0)