feat(app): show a What's New page after an update (#2664)

After an update the restarted app opens what the new version brought as an editor tab, and Help > What's New reopens it at any time. Its checkbox turns the automatic opening off for later updates; the same switch sits on System Settings > Updates next to the update checks. The update balloon keeps a one-paragraph summary.

The release workflow fills the updater manifest's notes from the release body without its Download section, the install records them, and a version installed outside the app reads them from the manifest. The first start of a different version is recognised from the last run version kept in settings.
Цей коміт міститься в:
Emanyzwww authored and GitHub committed 2026-11-11 16:42:32 +08:00
1 джерело f7a507a5db
коміт 14d9cdff11
24 files changed
+839 -23

No files matched your search

+2
Переглянути файл
@@ -15,6 +15,8 @@ export const CLIENT_SETTINGS_KEYS = [
"general.openProjectIn",
"general.updateSource",
"general.autoCheckUpdates",
"general.showWhatsNewAfterUpdate",
"general.lastRunVersion",
"general.dateFormat",
"editor.fontFamily",
"editor.fontSize",
+7
Переглянути файл
@@ -83,6 +83,12 @@
"app.update.restart": "Restart",
"app.update.retry": "Retry",
"app.update.retryWith": "Retry with {source}",
"app.whatsNew.loading": "Fetching release notes…",
"app.whatsNew.noNotes": "There are no release notes for this version.",
"app.whatsNew.openReleases": "Open Release Page",
"app.whatsNew.showAfterUpdate": "Show this page after every update",
"app.whatsNew.title": "What's New",
"app.whatsNew.version": "OpenIDEA {version}",
"app.window.desktopOnly": "Multiple windows require the desktop app",
"app.window.openFailed": "Cannot open {name}",
"app.window.pickFileTitle": "Open File",
@@ -109,6 +115,7 @@
"menu.app.installCli": "Install 'openidea' Command",
"menu.app.quit": "{os, select, macos {Quit OpenIDEA} other {Exit}}",
"menu.app.uninstallCli": "Uninstall 'openidea' Command",
"menu.app.whatsNew": "What's New",
"menu.appearance": "Appearance",
"menu.code": "Code",
"menu.code.commentBlock": "Comment with Block Comment",
+3 -1
Переглянути файл
@@ -989,5 +989,7 @@
"Imported {count} MCP servers from the project.": "Imported {count} MCP servers from the project.",
"Show branch and incoming/outgoing commits in the Project view": "Show branch and incoming/outgoing commits in the Project view",
"Up to date with {upstream}": "Up to date with {upstream}",
"Highlight occurrences of selected text": "Highlight occurrences of selected text"
"Highlight occurrences of selected text": "Highlight occurrences of selected text",
"Show What's New after an update": "Show What's New after an update",
"Opens a page with the release notes when a new version starts. Help › What's New opens it any time.": "Opens a page with the release notes when a new version starts. Help › What's New opens it any time."
}
+3 -1
Переглянути файл
@@ -7325,5 +7325,7 @@
"Imported {count} MCP servers from the project.": "已从项目导入 {count} 个 MCP 服务器。",
"Show branch and incoming/outgoing commits in the Project view": "在项目视图中显示分支及传入/传出提交",
"Up to date with {upstream}": "已与 {upstream} 同步",
"Highlight occurrences of selected text": "高亮所选文本的匹配项"
"Highlight occurrences of selected text": "高亮所选文本的匹配项",
"Show What's New after an update": "更新后显示“新功能”页面",
"Opens a page with the release notes when a new version starts. Help › What's New opens it any time.": "新版本首次启动时显示包含发行说明的页面。可随时通过“帮助 › 新功能”打开。"
}
+7
Переглянути файл
@@ -83,6 +83,12 @@
"app.update.restart": "重启",
"app.update.retry": "重试",
"app.update.retryWith": "改用 {source} 重试",
"app.whatsNew.loading": "正在获取发行说明…",
"app.whatsNew.noNotes": "此版本没有发行说明。",
"app.whatsNew.openReleases": "打开发布页面",
"app.whatsNew.showAfterUpdate": "每次更新后显示此页面",
"app.whatsNew.title": "新功能",
"app.whatsNew.version": "OpenIDEA {version}",
"app.window.desktopOnly": "多窗口需要桌面应用",
"app.window.openFailed": "无法打开 {name}",
"app.window.pickFileTitle": "打开文件",
@@ -109,6 +115,7 @@
"menu.app.installCli": "安装 'openidea' 命令",
"menu.app.quit": "{os, select, macos {退出 OpenIDEA} other {退出}}",
"menu.app.uninstallCli": "卸载 'openidea' 命令",
"menu.app.whatsNew": "新功能",
"menu.appearance": "外观",
"menu.code": "代码",
"menu.code.commentBlock": "使用块注释",
+33
Переглянути файл
@@ -0,0 +1,33 @@
import { beforeEach, describe, expect, it } from "vitest";
import { _resetReleaseNotesForTests, recordInstalledUpdate, releaseNotesOf } from "./releaseNotes";
beforeEach(() => {
_resetReleaseNotesForTests();
});
describe("the notes an install records", () => {
it("are shown for the version that was installed", () => {
recordInstalledUpdate("0.1.40", "## What's new\n\n- dev containers");
expect(releaseNotesOf("0.1.40")).toBe("## What's new\n\n- dev containers");
expect(releaseNotesOf("0.1.41")).toBeNull();
});
it("replace the previous install's notes", () => {
recordInstalledUpdate("0.1.40", "- first");
recordInstalledUpdate("0.1.41", "- second");
expect(releaseNotesOf("0.1.40")).toBeNull();
expect(releaseNotesOf("0.1.41")).toBe("- second");
});
it("leave nothing when the manifest had no notes", () => {
recordInstalledUpdate("0.1.40", "- first");
recordInstalledUpdate("0.1.41", " ");
expect(releaseNotesOf("0.1.40")).toBeNull();
expect(releaseNotesOf("0.1.41")).toBeNull();
});
it("ignore a stored value of the wrong shape", () => {
localStorage.setItem("openidea.whatsNew.notes.v1", '{"version":5,"text":true}');
expect(releaseNotesOf("0.1.40")).toBeNull();
});
});
+52
Переглянути файл
@@ -0,0 +1,52 @@
/**
* The release notes the updater installed, kept so the What's New page can show
* them after the restart that installs an update. localStorage, because an
* update replaces the app bundle but not the webview's data.
*/
const KEY = "openidea.whatsNew.notes.v1";
interface Stored {
version: string;
text: string;
}
function read(): Stored | null {
try {
const raw = globalThis.localStorage?.getItem(KEY);
const value: unknown = raw ? JSON.parse(raw) : null;
if (!value || typeof value !== "object") return null;
const stored = value as Partial<Stored>;
return typeof stored.version === "string" && typeof stored.text === "string"
? { version: stored.version, text: stored.text }
: null;
} catch {
return null;
}
}
/** Called once an update installed, with the notes its manifest carried. */
export function recordInstalledUpdate(version: string, notes: string | null): void {
const text = notes?.trim();
try {
if (text) globalThis.localStorage?.setItem(KEY, JSON.stringify({ version, text }));
else globalThis.localStorage?.removeItem(KEY);
} catch {
/* storage unavailable: the page reads the manifest instead */
}
}
/** Notes recorded when this version was installed, so the page shows them offline. */
export function releaseNotesOf(version: string): string | null {
const stored = read();
return stored?.version === version ? stored.text : null;
}
/** Tests only. */
export function _resetReleaseNotesForTests(): void {
try {
globalThis.localStorage?.removeItem(KEY);
} catch {
/* storage unavailable */
}
}
+11
Переглянути файл
@@ -0,0 +1,11 @@
import { resolveLocale } from "@/platform/i18n";
import type { UpdateSource } from "@/platform/ipc";
import { useProject } from "@/platform/project";
/** System Settings > Updates > Update source; `auto` picks the CNB mirror for the Chinese UI. */
export function updateSource(): UpdateSource {
const { settings } = useProject.getState();
const chosen = settings?.general?.updateSource;
if (chosen === "github" || chosen === "cnb") return chosen;
return resolveLocale(settings?.appearance?.locale) === "zh" ? "cnb" : "github";
}