Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Show release notes locally when showing update notification (#18486)
Joseph T. Lyons1021f0e28808
diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rsindex 1fe89cce0f9..60d6369ee86 100644--- a/crates/auto_update/src/auto_update.rs+++ b/crates/auto_update/src/auto_update.rs@@ -345,15 +345,17 @@ pub fn notify_of_any_new_update(cx: &mut ViewContext<Workspace>) -> Option<()> {let should_show_notification = should_show_notification.await?;if should_show_notification {workspace.update(&mut cx, |workspace, cx| {+ let workspace_handle = workspace.weak_handle();workspace.show_notification(NotificationId::unique::<UpdateNotification>(),cx,- |cx| cx.new_view(|_| UpdateNotification::new(version)),+ |cx| cx.new_view(|_| UpdateNotification::new(version, workspace_handle)),);- updater- .read(cx)- .set_should_show_update_notification(false, cx)- .detach_and_log_err(cx);+ updater.update(cx, |updater, cx| {+ updater+ .set_should_show_update_notification(false, cx)+ .detach_and_log_err(cx);+ });})?;}anyhow::Ok(())diff --git a/crates/auto_update/src/update_notification.rs b/crates/auto_update/src/update_notification.rsindex 66028c24011..7568a0eb1a9 100644--- a/crates/auto_update/src/update_notification.rs+++ b/crates/auto_update/src/update_notification.rs@@ -1,13 +1,18 @@use gpui::{div, DismissEvent, EventEmitter, InteractiveElement, IntoElement, ParentElement, Render,- SemanticVersion, StatefulInteractiveElement, Styled, ViewContext,+ SemanticVersion, StatefulInteractiveElement, Styled, ViewContext, WeakView,};use menu::Cancel;use release_channel::ReleaseChannel;-use workspace::ui::{h_flex, v_flex, Icon, IconName, Label, StyledExt};+use util::ResultExt;+use workspace::{+ ui::{h_flex, v_flex, Icon, IconName, Label, StyledExt},+ Workspace,+};pub struct UpdateNotification {version: SemanticVersion,+ workspace: WeakView<Workspace>,}impl EventEmitter<DismissEvent> for UpdateNotification {}@@ -41,7 +46,11 @@ impl Render for UpdateNotification {.child(Label::new("View the release notes")).cursor_pointer().on_click(cx.listener(|this, _, cx| {- crate::view_release_notes(&Default::default(), cx);+ this.workspace+ .update(cx, |workspace, cx| {+ crate::view_release_notes_locally(workspace, cx);+ })+ .log_err();this.dismiss(&menu::Cancel, cx)})),)@@ -49,8 +58,8 @@ impl Render for UpdateNotification {}impl UpdateNotification {- pub fn new(version: SemanticVersion) -> Self {- Self { version }+ pub fn new(version: SemanticVersion, workspace: WeakView<Workspace>) -> Self {+ Self { version, workspace }}pub fn dismiss(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {