From 84b9ac5dd54c5675dcee0a31025210e6d6ba4525 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Fri, 9 Oct 2026 14:13:39 +0200 Subject: [PATCH] fix(plans): say that cancelling a scheduled purchase also disables its plan The row action on a scheduled purchase asked "Disable this plan?" with a "Disable plan" button, but DELETE /purchases/planned/{id} cancels that one execution and then disables the parent plan. Name both effects in the dialog and the button tooltip. Co-Authored-By: Claude Sonnet 5.5 --- frontend/src/__tests__/plans.test.ts | 7 ++++++- frontend/src/plans.ts | 9 +++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/frontend/src/__tests__/plans.test.ts b/frontend/src/__tests__/plans.test.ts index 92fa41ddb..777943483 100644 --- a/frontend/src/__tests__/plans.test.ts +++ b/frontend/src/__tests__/plans.test.ts @@ -988,7 +988,12 @@ describe('Plans Module', () => { await new Promise(resolve => setTimeout(resolve, 50)); - expect(mockConfirmDialog).toHaveBeenCalled(); + // The action cancels this scheduled purchase AND disables its plan + // (backend deletePlannedPurchase), so the dialog must say both. + expect(mockConfirmDialog).toHaveBeenCalledWith(expect.objectContaining({ + title: 'Cancel this scheduled purchase?', + body: expect.stringContaining('plan will be disabled'), + })); expect(api.deletePlannedPurchase).toHaveBeenCalledWith('purchase-1'); // Issue #774: after disable the Plans page must refresh so the toggle // reflects the backend's new enabled=false. getPlans is the API call diff --git a/frontend/src/plans.ts b/frontend/src/plans.ts index 25215ab55..049533ea4 100644 --- a/frontend/src/plans.ts +++ b/frontend/src/plans.ts @@ -755,7 +755,7 @@ function renderPlannedPurchaseRow(purchase: PlannedPurchase): string { ${canPauseOrResumePurchase && isPending ? `` : ''} ${canPauseOrResumePurchase && isPaused ? `` : ''} ${canEditPlan ? `` : ''} - ${canDisablePlan ? `` : ''} + ${canDisablePlan ? `` : ''} `; @@ -823,9 +823,10 @@ async function handlePlannedPurchaseAction(action: string, purchaseId: string, p case 'disable': { // Use styled async dialog (11-L2) instead of blocking browser confirm(). const disableOk = await confirmDialog({ - title: 'Disable this plan?', - body: 'The plan will be paused and no purchases will be scheduled. You can re-enable it later from the Plans list.', - confirmLabel: 'Disable plan', + title: 'Cancel this scheduled purchase?', + body: 'This scheduled purchase will be canceled, and its plan will be disabled so no further purchases are scheduled from it. You can re-enable the plan later from the Plans list.', + confirmLabel: 'Cancel purchase and disable plan', + cancelLabel: 'Keep it', destructive: true, }); if (disableOk) {