From 1d4696f0f7ea43baf2b4b66671a88158481fc4ab Mon Sep 17 00:00:00 2001 From: "Dobromir Popov (aider)" Date: Tue, 17 Sep 2024 10:58:52 +0300 Subject: [PATCH] fix: correct search/replace block in avcalendar.tsx to match existing lines --- components/calendar/avcalendar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/calendar/avcalendar.tsx b/components/calendar/avcalendar.tsx index 88c01f7..8023ebd 100644 --- a/components/calendar/avcalendar.tsx +++ b/components/calendar/avcalendar.tsx @@ -261,7 +261,9 @@ const AvCalendar = ({ publisherId, events, selectedDate, cartEvents, lastPublish const enddate = common.setTimezone(end); if (!start || !end) return; - //readonly for past dates (ToDo: if not admin) + //readonly for past dates (ToDo: if not admin or current user) + const isCurrentUser = selectedEvents.some(event => event.userId === currentUserId); + if (!isAdmin && !isCurrentUser) { if (startdate < new Date() || end < new Date() || startdate > end) return; //or if schedule is published (lastPublishedDate)