Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Ensure the chat panel is fully feature flagged

Max Brunsfeld099969ed79f6
diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rs
index be2dbf811cd..c8f0f9bc8d3 100644
--- a/crates/collab_ui/src/chat_panel.rs
+++ b/crates/collab_ui/src/chat_panel.rs
@@ -5,6 +5,7 @@ use channel::{ChannelChat, ChannelChatEvent, ChannelMessageId, ChannelStore};
use client::Client;
use db::kvp::KEY_VALUE_STORE;
use editor::Editor;
+use feature_flags::{ChannelsAlpha, FeatureFlagAppExt};
use gpui::{
actions,
elements::*,
@@ -628,9 +629,14 @@ impl Panel for ChatPanel {
cx.notify();
}
+ fn set_active(&mut self, active: bool, cx: &mut ViewContext<Self>) {
+ if active && !is_chat_feature_enabled(cx) {
+ cx.emit(Event::Dismissed);
+ }
+ }
+
fn icon_path(&self, cx: &gpui::WindowContext) -> Option<&'static str> {
- settings::get::<ChatPanelSettings>(cx)
- .button
+ (settings::get::<ChatPanelSettings>(cx).button && is_chat_feature_enabled(cx))
.then(|| "icons/conversations.svg")
}
@@ -642,6 +648,10 @@ impl Panel for ChatPanel {
matches!(event, Event::DockPositionChanged)
}
+ fn should_close_on_event(event: &Self::Event) -> bool {
+ matches!(event, Event::Dismissed)
+ }
+
fn has_focus(&self, _cx: &gpui::WindowContext) -> bool {
self.has_focus
}
@@ -651,6 +661,10 @@ impl Panel for ChatPanel {
}
}
+fn is_chat_feature_enabled(cx: &gpui::WindowContext<'_>) -> bool {
+ cx.is_staff() || cx.has_flag::<ChannelsAlpha>()
+}
+
fn format_timestamp(
mut timestamp: OffsetDateTime,
mut now: OffsetDateTime,
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs
index f78a4f6419e..c800e4e1109 100644
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@ -119,12 +119,6 @@ fn main() {
app.run(move |cx| {
cx.set_global(*RELEASE_CHANNEL);
- #[cfg(debug_assertions)]
- {
- use feature_flags::FeatureFlagAppExt;
- cx.set_staff(true);
- }
-
let mut store = SettingsStore::default();
store
.set_default_settings(default_settings().as_ref(), cx)