fix(webdav): only show auto-sync callout for auto-source errors

This commit is contained in:
saladday
2026-02-15 01:01:02 +08:00
parent 4be515e178
commit 0b4912090a
2 changed files with 29 additions and 3 deletions

View File

@@ -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 ─────────────────────────────────────────────

View File

@@ -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: "" });