From 85a6782ae993896b944954243c73f3950812fbf4 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Sep 2026 09:04:33 +0000 Subject: [PATCH] BulkFixTimezoneShiftButton: confirm before firing Addresses a Copilot review finding on buzz-code/react-admin-nestjs#167: the button fired immediately on click, no confirmation, for an action that can corrupt already-correct data if run on the wrong rows. Passing children to BulkActionButton switches it to dialog mode (via BulkRequestButton/ActionOrDialogButton), so it now shows a warning with the selected-row count and requires an explicit confirm click. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01KeX6BFe7P4pHLPm3VwFjPn --- .../crudContainers/BulkFixTimezoneShiftButton.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/crudContainers/BulkFixTimezoneShiftButton.jsx b/components/crudContainers/BulkFixTimezoneShiftButton.jsx index dfd02d9..e7ae457 100644 --- a/components/crudContainers/BulkFixTimezoneShiftButton.jsx +++ b/components/crudContainers/BulkFixTimezoneShiftButton.jsx @@ -1,11 +1,23 @@ +import Typography from '@mui/material/Typography'; +import { useListContext } from 'react-admin'; import { useIsAdmin } from '@shared/utils/permissionsUtil'; import { BulkActionButton } from './BulkActionButton'; // Admin-only: corrects createdAt/updatedAt on the selected rows for records // written before the mysql connection was pinned to UTC (nra-server#44). +// Confirms first: running this on rows that were already written correctly +// (after that fix) would shift them the wrong way. export const BulkFixTimezoneShiftButton = ({ label = 'תיקון שעון (UTC)' }) => { const isAdmin = useIsAdmin(); + const { selectedIds } = useListContext(); if (!isAdmin) return null; - return ; + return ( + + + הפעולה תתקן את השעה השמורה ב-{selectedIds?.length ?? 0} הרשומות שנבחרו, בהנחה שנכתבו + לפני תיקון אזור הזמן. הפעלה על רשומות שכבר תקינות תזיז את השעה שלהן בטעות. להמשיך? + + + ); };