[#497 & #517] updated event editability in the calendar grid (#519)

* [#497 & #517] updated event editability in the calendar grid to prevent accidental editing and editing event we are not organizer of
This commit is contained in:
Camille Moussu
2026-02-06 11:23:29 +01:00
committed by GitHub
parent b8e837fea6
commit 1720965f0f
2 changed files with 12 additions and 5 deletions
+3 -1
View File
@@ -693,7 +693,9 @@ export default function CalendarApp({
events={eventToFullCalendarFormat( events={eventToFullCalendarFormat(
filteredEvents, filteredEvents,
filteredTempEvents, filteredTempEvents,
userId userId,
userData?.email,
isPending
)} )}
eventOrder={(a: any, b: any) => eventOrder={(a: any, b: any) =>
a.extendedProps.priority - b.extendedProps.priority a.extendedProps.priority - b.extendedProps.priority
@@ -68,7 +68,9 @@ export function formatEventChipTitle(e: CalendarEvent, t: Function) {
export const eventToFullCalendarFormat = ( export const eventToFullCalendarFormat = (
filteredEvents: CalendarEvent[], filteredEvents: CalendarEvent[],
filteredTempEvents: CalendarEvent[], filteredTempEvents: CalendarEvent[],
userId: string | undefined userId: string | undefined,
userAddress: string | undefined,
pending: boolean
) => { ) => {
const { t } = useI18n(); const { t } = useI18n();
return filteredEvents return filteredEvents
@@ -76,14 +78,17 @@ export const eventToFullCalendarFormat = (
.map((e) => { .map((e) => {
const eventTimezone = e.timezone || "Etc/UTC"; const eventTimezone = e.timezone || "Etc/UTC";
const isAllDay = e.allday ?? false; const isAllDay = e.allday ?? false;
const isPersonnalEvent = extractEventBaseUuid(e.calId) === userId; const isOrganiser = e.organizer
? e.organizer.cal_address?.toLowerCase() === userAddress?.toLowerCase()
: true; // if there are no organizer in the event we assume it was organized by the owner
const isPersonnalEvent =
extractEventBaseUuid(e.calId) === userId && isOrganiser;
const convertedEvent: any = { const convertedEvent: any = {
...e, ...e,
title: formatEventChipTitle(e, t), title: formatEventChipTitle(e, t),
colors: e.color, colors: e.color,
editable: isPersonnalEvent, editable: isPersonnalEvent,
priority: isPersonnalEvent ? 1 : 0, priority: isPersonnalEvent && !pending ? 1 : 0,
}; };
if (!isAllDay && e.start && eventTimezone) { if (!isAllDay && e.start && eventTimezone) {