assistant panel: Use feature flag for Zed Pro mentions (#15903)

Thorsten Ball and Bennet created

This removes Zed Pro mentions.

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>

Change summary

crates/assistant/src/assistant_panel.rs |  8 ++--
crates/assistant/src/model_selector.rs  | 46 ++++++++++++--------------
2 files changed, 26 insertions(+), 28 deletions(-)

Detailed changes

crates/assistant/src/assistant_panel.rs 🔗

@@ -2447,10 +2447,10 @@ impl ContextEditor {
     }
 
     fn render_notice(&self, cx: &mut ViewContext<Self>) -> Option<AnyElement> {
-        let nudge = self
-            .assistant_panel
-            .upgrade()
-            .map(|assistant_panel| assistant_panel.read(cx).show_zed_ai_notice);
+        use feature_flags::FeatureFlagAppExt;
+        let nudge = self.assistant_panel.upgrade().map(|assistant_panel| {
+            assistant_panel.read(cx).show_zed_ai_notice && cx.has_flag::<feature_flags::ZedPro>()
+        });
 
         if let Some(error) = self.error_message.clone() {
             Some(Self::render_error_popover(error, cx).into_any_element())

crates/assistant/src/model_selector.rs 🔗

@@ -1,4 +1,3 @@
-use feature_flags::LanguageModels;
 use feature_flags::ZedPro;
 use language_model::{LanguageModel, LanguageModelAvailability, LanguageModelRegistry};
 use proto::Plan;
@@ -194,9 +193,6 @@ impl PickerDelegate for ModelPickerDelegate {
 
     fn render_footer(&self, cx: &mut ViewContext<Picker<Self>>) -> Option<gpui::AnyElement> {
         use feature_flags::FeatureFlagAppExt;
-        if !cx.has_flag::<LanguageModels>() {
-            return None;
-        }
 
         let plan = proto::Plan::ZedPro;
         let is_trial = false;
@@ -209,26 +205,28 @@ impl PickerDelegate for ModelPickerDelegate {
                 .p_1()
                 .gap_4()
                 .justify_between()
-                .child(match plan {
-                    // Already a zed pro subscriber
-                    Plan::ZedPro => Button::new("zed-pro", "Zed Pro")
-                        .icon(IconName::ZedAssistant)
-                        .icon_size(IconSize::Small)
-                        .icon_color(Color::Muted)
-                        .icon_position(IconPosition::Start)
-                        .on_click(|_, cx| {
-                            cx.dispatch_action(Box::new(zed_actions::OpenAccountSettings))
-                        }),
-                    // Free user
-                    Plan::Free => Button::new(
-                        "try-pro",
-                        if is_trial {
-                            "Upgrade to Pro"
-                        } else {
-                            "Try Pro"
-                        },
-                    )
-                    .on_click(|_, cx| cx.open_url(TRY_ZED_PRO_URL)),
+                .when(cx.has_flag::<ZedPro>(), |this| {
+                    this.child(match plan {
+                        // Already a zed pro subscriber
+                        Plan::ZedPro => Button::new("zed-pro", "Zed Pro")
+                            .icon(IconName::ZedAssistant)
+                            .icon_size(IconSize::Small)
+                            .icon_color(Color::Muted)
+                            .icon_position(IconPosition::Start)
+                            .on_click(|_, cx| {
+                                cx.dispatch_action(Box::new(zed_actions::OpenAccountSettings))
+                            }),
+                        // Free user
+                        Plan::Free => Button::new(
+                            "try-pro",
+                            if is_trial {
+                                "Upgrade to Pro"
+                            } else {
+                                "Try Pro"
+                            },
+                        )
+                        .on_click(|_, cx| cx.open_url(TRY_ZED_PRO_URL)),
+                    })
                 })
                 .child(
                     Button::new("configure", "Configure")