auto-update: Link to the current release's changelog, not the latest one (#3076)

An user complained in zed-industries/community#2093 that we always link
to the latest release changelog, not the one that they've just updated
to.


Release Notes:
- Fixed changelog link in update notification always leading to the
latest release changelog, not the one that was updated to. Fixes
zed-industries/community#2093.
This commit is contained in:
Piotr Osiewicz 2023-10-02 15:24:09 +02:00 committed by GitHub
parent 95e09dd2e9
commit a785eb9141
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,13 +115,15 @@ pub fn check(_: &Check, cx: &mut AppContext) {
fn view_release_notes(_: &ViewReleaseNotes, cx: &mut AppContext) {
if let Some(auto_updater) = AutoUpdater::get(cx) {
let server_url = &auto_updater.read(cx).server_url;
let auto_updater = auto_updater.read(cx);
let server_url = &auto_updater.server_url;
let current_version = auto_updater.current_version;
let latest_release_url = if cx.has_global::<ReleaseChannel>()
&& *cx.global::<ReleaseChannel>() == ReleaseChannel::Preview
{
format!("{server_url}/releases/preview/latest")
format!("{server_url}/releases/preview/{current_version}")
} else {
format!("{server_url}/releases/stable/latest")
format!("{server_url}/releases/stable/{current_version}")
};
cx.platform().open_url(&latest_release_url);
}