From 0b4912090af2403c93b4aaee2e1bfdd8f123f81e Mon Sep 17 00:00:00 2001 From: saladday <1203511142@qq.com> Date: Sun, 15 Feb 2026 01:01:02 +0800 Subject: [PATCH] fix(webdav): only show auto-sync callout for auto-source errors --- src/components/settings/WebdavSyncSection.tsx | 4 +-- tests/components/WebdavSyncSection.test.tsx | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/components/settings/WebdavSyncSection.tsx b/src/components/settings/WebdavSyncSection.tsx index 69d7235d9..ef4e2c544 100644 --- a/src/components/settings/WebdavSyncSection.tsx +++ b/src/components/settings/WebdavSyncSection.tsx @@ -449,9 +449,7 @@ export function WebdavSyncSection({ config }: WebdavSyncSectionProps) { : null; const lastError = config?.status?.lastError?.trim(); const showAutoSyncError = - !!lastError && - (config?.status?.lastErrorSource === "auto" || - (!config?.status?.lastErrorSource && !!config?.autoSync)); + !!lastError && config?.status?.lastErrorSource === "auto"; // ─── Render ───────────────────────────────────────────── diff --git a/tests/components/WebdavSyncSection.test.tsx b/tests/components/WebdavSyncSection.test.tsx index 5facc00db..ddffd51ed 100644 --- a/tests/components/WebdavSyncSection.test.tsx +++ b/tests/components/WebdavSyncSection.test.tsx @@ -155,6 +155,34 @@ describe("WebdavSyncSection", () => { expect(screen.getByText("network timeout")).toBeInTheDocument(); }); + it("does not show auto sync error callout for manual sync errors", () => { + renderSection({ + ...baseConfig, + status: { + lastError: "manual upload failed", + lastErrorSource: "manual", + }, + }); + + expect( + screen.queryByText("settings.webdavSync.autoSyncLastErrorTitle"), + ).not.toBeInTheDocument(); + }); + + it("does not show auto sync error callout when source is missing", () => { + renderSection({ + ...baseConfig, + autoSync: true, + status: { + lastError: "legacy error without source", + }, + }); + + expect( + screen.queryByText("settings.webdavSync.autoSyncLastErrorTitle"), + ).not.toBeInTheDocument(); + }); + it("shows validation error when saving without base url", async () => { renderSection({ ...baseConfig, baseUrl: "" });