#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
fix(desktop): keep the installed version visible when updates are managed off (#8437)
Samuel Saez Lopez7a5ef2cad81d
diff --git a/frontend/public/locales/en-US/translation.toml b/frontend/public/locales/en-US/translation.tomlindex 843d700e39..8f3f81a622 100644--- a/frontend/public/locales/en-US/translation.toml+++ b/frontend/public/locales/en-US/translation.toml@@ -12285,6 +12285,7 @@ checkForUpdates = "Check for Updates"currentBackendVersion = "Current Backend Version"currentFrontendVersion = "Current Frontend Version"description = "Check for updates and view version information"+descriptionManaged = "View version information"latestVersion = "Latest Version"managedByAdmin = "Managed by administrator"modeAuto = "Install updates automatically"diff --git a/frontend/src/editor/core/components/shared/config/configSections/preferences/PreferencesSection.tsx b/frontend/src/editor/core/components/shared/config/configSections/preferences/PreferencesSection.tsxindex 83d41cd3c7..d91651abfe 100644--- a/frontend/src/editor/core/components/shared/config/configSections/preferences/PreferencesSection.tsx+++ b/frontend/src/editor/core/components/shared/config/configSections/preferences/PreferencesSection.tsx@@ -17,7 +17,7 @@ import "@editor/components/shared/config/configSections/preferences/PreferencesSexport interface PreferencesSectionProps {/** SaaS: login is always on, so the "turn login on" banner never applies. */hideAdminBanner?: boolean;- /** SaaS build and managed-disabled desktop: no update UI, and no update call. */+ /** SaaS build: no update UI, and no update call. */hideUpdateSection?: boolean;desktopInstall?: DesktopInstall;desktopUpdateMode?: DesktopUpdateModeControl;diff --git a/frontend/src/editor/core/components/shared/config/configSections/preferences/SoftwareUpdatesCard.tsx b/frontend/src/editor/core/components/shared/config/configSections/preferences/SoftwareUpdatesCard.tsxindex 5992480dc5..519ffff4d1 100644--- a/frontend/src/editor/core/components/shared/config/configSections/preferences/SoftwareUpdatesCard.tsx+++ b/frontend/src/editor/core/components/shared/config/configSections/preferences/SoftwareUpdatesCard.tsx@@ -41,13 +41,18 @@ export function SoftwareUpdatesCard({// falling back to the backend version.const currentVersion = appVersion ?? backendVersion ?? null;+ // An administrator turned updates off: the card still reports the version and+ // the locked mode, but must not reach the update server.+ const updatesManagedOff =+ desktopUpdateMode?.mode === "disabled" && desktopUpdateMode.locked;+// Check for updates on mount. The card is not rendered at all when the update- // UI is hidden (SaaS build, managed-disabled desktop), so no call ever fires.+ // UI is hidden (SaaS build), so no call fires there.useEffect(() => {- if (currentVersion) {+ if (currentVersion && !updatesManagedOff) {checkForUpdate();}- }, [currentVersion, config?.machineType]);+ }, [currentVersion, config?.machineType, updatesManagedOff]);const checkForUpdate = async () => {if (!currentVersion) return;@@ -94,10 +99,15 @@ export function SoftwareUpdatesCard({<Stack gap="md"><Group justify="space-between" align="center"><Text size="xs" c="dimmed">- {t(- "settings.general.updates.description",- "Check for updates and view version information",- )}+ {updatesManagedOff+ ? t(+ "settings.general.updates.descriptionManaged",+ "View version information",+ )+ : t(+ "settings.general.updates.description",+ "Check for updates and view version information",+ )}</Text>{updateSummary && (<Badge@@ -151,19 +161,21 @@ export function SoftwareUpdatesCard({)}</div><Group gap="sm">- <Button- size="sm"- variant="secondary"- onClick={checkForUpdate}- loading={checkingUpdate}- disabled={!currentVersion}- leftSection={<Icon name="refresh-cw" size="1rem" />}- >- {t(- "settings.general.updates.checkForUpdates",- "Check for Updates",- )}- </Button>+ {!updatesManagedOff && (+ <Button+ size="sm"+ variant="secondary"+ onClick={checkForUpdate}+ loading={checkingUpdate}+ disabled={!currentVersion}+ leftSection={<Icon name="refresh-cw" size="1rem" />}+ >+ {t(+ "settings.general.updates.checkForUpdates",+ "Check for Updates",+ )}+ </Button>+ )}{updateSummary && (<Buttonsize="sm"diff --git a/frontend/src/editor/desktop/components/shared/config/configSections/GeneralSection.test.tsx b/frontend/src/editor/desktop/components/shared/config/configSections/GeneralSection.test.tsxindex 6cfe801f85..9ce2beb265 100644--- a/frontend/src/editor/desktop/components/shared/config/configSections/GeneralSection.test.tsx+++ b/frontend/src/editor/desktop/components/shared/config/configSections/GeneralSection.test.tsx@@ -86,7 +86,7 @@ describe("desktop GeneralSection update policy", () => {});});- it("does not mount update controls or check updates before managed-disabled policy loads", async () => {+ it("shows the version but checks nothing when updates are managed-disabled", async () => {let resolvePolicy!: (info: UpdateModeInfo) => void;vi.mocked(desktopUpdateService.getUpdateModeInfo).mockReturnValue(new Promise<UpdateModeInfo>((resolve) => {@@ -106,10 +106,16 @@ describe("desktop GeneralSection update policy", () => {resolvePolicy({ mode: "disabled", locked: true });});+ // An administrator who turned updates off still needs to see what is installed.+ expect(await screen.findByText("3.0.1")).toBeInTheDocument();+ expect(screen.getByLabelText("Update behavior")).toBeDisabled();+ expect(screen.getByText("View version information")).toBeInTheDocument();+ expect(+ screen.queryByText("Check for updates and view version information"),+ ).not.toBeInTheDocument();expect(screen.queryByRole("button", { name: "Check for Updates" }),).not.toBeInTheDocument();- expect(screen.queryByLabelText("Update behavior")).not.toBeInTheDocument();expect(updateService.getUpdateSummary).not.toHaveBeenCalled();expect(checkTauriUpdate).not.toHaveBeenCalled();});diff --git a/frontend/src/editor/desktop/components/shared/config/configSections/GeneralSection.tsx b/frontend/src/editor/desktop/components/shared/config/configSections/GeneralSection.tsxindex 249a6f9d42..e19240a166 100644--- a/frontend/src/editor/desktop/components/shared/config/configSections/GeneralSection.tsx+++ b/frontend/src/editor/desktop/components/shared/config/configSections/GeneralSection.tsx@@ -100,11 +100,7 @@ const GeneralSection: React.FC<PreferencesSectionProps> = ({</>}// Mounting the card starts its summary request, so policy must be known first.- hideUpdateSection={- hideUpdateSection ||- !updateModeInfo ||- (updateModeInfo.mode === "disabled" && updateModeInfo.locked)- }+ hideUpdateSection={hideUpdateSection || !updateModeInfo}desktopInstall={{state: install.state,progress: install.progress,