From 6a70a8335f96bf7354389e77c5c0344840686bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9F=BA=E9=AD=81?= <1412414664@qq.com> Date: Mon, 6 Jul 2026 12:35:15 +0800 Subject: [PATCH] fix(settings): hide auto-update controls on Linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冯基魁 <1412414664@qq.com> --- .../settings/tabs/__tests__/version-tab.test.tsx | 13 +++++++++++++ .../common/components/settings/tabs/version-tab.tsx | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/renderer/src/common/components/settings/tabs/__tests__/version-tab.test.tsx b/renderer/src/common/components/settings/tabs/__tests__/version-tab.test.tsx index 9b236cc1b..a886b166f 100644 --- a/renderer/src/common/components/settings/tabs/__tests__/version-tab.test.tsx +++ b/renderer/src/common/components/settings/tabs/__tests__/version-tab.test.tsx @@ -354,6 +354,19 @@ describe('VersionTab', () => { expect(screen.queryByText('Updates')).not.toBeInTheDocument() }) + it('hides the auto-update controls on Linux', () => { + window.electronAPI.isLinux = true + + renderWithProviders( + + ) + + expect(screen.queryByText('Updates')).not.toBeInTheDocument() + expect( + screen.queryByRole('switch', { name: /downloads/i }) + ).not.toBeInTheDocument() + }) + it('hides the update-available banner when auto-update permission is false', () => { import.meta.env.MODE = 'production' diff --git a/renderer/src/common/components/settings/tabs/version-tab.tsx b/renderer/src/common/components/settings/tabs/version-tab.tsx index 2245831d1..e671bc697 100644 --- a/renderer/src/common/components/settings/tabs/version-tab.tsx +++ b/renderer/src/common/components/settings/tabs/version-tab.tsx @@ -55,7 +55,9 @@ export function VersionTab({ appInfo, isLoading, error }: VersionTabProps) { useAutoUpdateStatus() const { mutateAsync: setAutoUpdate, isPending: isSetAutoUpdatePending } = useSetAutoUpdate() + const isLinux = window.electronAPI?.isLinux const canShowAutoUpdate = canShow(PERMISSION_KEYS.AUTO_UPDATE) + const canShowAutoUpdateControls = canShowAutoUpdate && !isLinux const canShowUpdateAlert = canShowAutoUpdate && appInfo?.isNewVersionAvailable && isProduction @@ -82,7 +84,6 @@ export function VersionTab({ appInfo, isLoading, error }: VersionTabProps) { } const handleManualUpdate = () => { - const isLinux = window.electronAPI?.isLinux if (isLinux) { window.open(GITHUB_RELEASES_URL) @@ -144,7 +145,7 @@ export function VersionTab({ appInfo, isLoading, error }: VersionTabProps) { - {canShowAutoUpdate && ( + {canShowAutoUpdateControls && ( <> Updates