Fix 'calendar no longer available' for invited events

The shared-calendar removal guard checks allCalendarIds, which only
contains the user's own + shared calendars. Invited events belong to
the inviter's calendar, triggering a false positive. Skip the check
for invited events.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kyle 2026-03-16 13:41:20 +08:00
parent bafda61958
commit 496666ec5a

View File

@ -242,9 +242,10 @@ export default function CalendarPage() {
const selectedEventPermission = selectedEvent ? permissionMap.get(selectedEvent.calendar_id) ?? null : null; const selectedEventPermission = selectedEvent ? permissionMap.get(selectedEvent.calendar_id) ?? null : null;
const selectedEventIsShared = selectedEvent ? sharedCalendarIds.has(selectedEvent.calendar_id) : false; const selectedEventIsShared = selectedEvent ? sharedCalendarIds.has(selectedEvent.calendar_id) : false;
// Close panel if shared calendar was removed while viewing // Close panel if shared calendar was removed while viewing (skip for invited events)
useEffect(() => { useEffect(() => {
if (!selectedEvent || allCalendarIds.size === 0) return; if (!selectedEvent || allCalendarIds.size === 0) return;
if (selectedEvent.is_invited) return;
if (!allCalendarIds.has(selectedEvent.calendar_id)) { if (!allCalendarIds.has(selectedEvent.calendar_id)) {
handlePanelClose(); handlePanelClose();
toast.info('This calendar is no longer available'); toast.info('This calendar is no longer available');