Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(desktop): link update prompt to changelog (#7088)
Jiayuan Zhang21e77f362502
diff --git a/apps/desktop/src/renderer/src/components/update-notification.test.tsx b/apps/desktop/src/renderer/src/components/update-notification.test.tsxnew file mode 100644index 0000000000..5e69300c46--- /dev/null+++ b/apps/desktop/src/renderer/src/components/update-notification.test.tsx@@ -0,0 +1,59 @@+import { act, fireEvent, render, screen } from "@testing-library/react";+import { beforeEach, describe, expect, it, vi } from "vitest";++import { UpdateNotification } from "./update-notification";++const mocks = vi.hoisted(() => ({+ installUpdate: vi.fn(),+ openExternal: vi.fn(),+}));++type UpdateDownloadedListener = (info: {+ version: string;+ releaseNotes?: string;+}) => void;++describe("UpdateNotification", () => {+ let updateDownloaded: UpdateDownloadedListener;++ beforeEach(() => {+ mocks.installUpdate.mockReset().mockResolvedValue(undefined);+ mocks.openExternal.mockReset().mockResolvedValue(undefined);++ Object.defineProperty(window, "desktopAPI", {+ configurable: true,+ value: { openExternal: mocks.openExternal },+ });+ Object.defineProperty(window, "updater", {+ configurable: true,+ value: {+ onUpdateDownloaded: (listener: UpdateDownloadedListener) => {+ updateDownloaded = listener;+ return vi.fn();+ },+ installUpdate: mocks.installUpdate,+ },+ });+ });++ it("opens the downloaded version's changelog from the update prompt", () => {+ render(<UpdateNotification />);+ act(() => updateDownloaded({ version: "0.4.27" }));++ expect(screen.queryByRole("button", { name: "Later" })).not.toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "See changelog" }));++ expect(mocks.openExternal).toHaveBeenCalledWith(+ "https://multica.ai/changelog#release-0-4-27",+ );+ });++ it("still installs the update immediately from the primary action", () => {+ render(<UpdateNotification />);+ act(() => updateDownloaded({ version: "0.4.27" }));++ fireEvent.click(screen.getByRole("button", { name: "Restart now" }));++ expect(mocks.installUpdate).toHaveBeenCalledOnce();+ });+});diff --git a/apps/desktop/src/renderer/src/components/update-notification.tsx b/apps/desktop/src/renderer/src/components/update-notification.tsxindex bb83192fa0..2da1b767b3 100644--- a/apps/desktop/src/renderer/src/components/update-notification.tsx+++ b/apps/desktop/src/renderer/src/components/update-notification.tsx@@ -8,6 +8,10 @@ type UpdateState =| { status: "idle" }| { status: "ready"; version: string };+function changelogUrl(version: string): string {+ return `https://multica.ai/changelog#release-${version.replace(/\./g, "-")}`;+}+export function UpdateNotification() {const [state, setState] = useState<UpdateState>({ status: "idle" });const [dismissed, setDismissed] = useState(false);@@ -45,10 +49,12 @@ export function UpdateNotification() {<div className="mt-2 flex items-center gap-1.5"><buttontype="button"- onClick={() => setDismissed(true)}+ onClick={() =>+ window.desktopAPI.openExternal(changelogUrl(state.version))+ }className="inline-flex items-center rounded-md border border-border bg-background px-3 py-1.5 text-caption font-medium text-foreground hover:bg-accent transition-colors">- Later+ See changelog</button><buttontype="button"