fix(calendar): produce correct JMAP patch when removing recurrence rules

When editing a recurring event and clearing its recurrence, the update
patch was omitting recurrenceRules entirely instead of setting it to null.
The server never received the change. Also clear recurrenceOverrides and
excludedRecurrenceRules so orphaned exceptions don't persist. Same fix
applied to locations and alerts removal.

Fix "this_and_future" scope overriding recurrence removal by reordering
the spread so user updates take precedence over master's original rules.

Closes root-fr/jmap-webmail#14
This commit is contained in:
Matthieu MALVACHE
2026-02-22 17:50:53 +01:00
parent 82a27a1f52
commit 7e42d2dedf
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -349,9 +349,9 @@ export default function CalendarPage() {
freeBusyStatus: master.freeBusyStatus,
privacy: master.privacy,
showWithoutTime: master.showWithoutTime,
recurrenceRules: originalRules,
...updates,
start: updates.start || occurrenceStart,
recurrenceRules: originalRules,
};
delete (newEventData as Record<string, unknown>).id;
delete (newEventData as Record<string, unknown>).uid;
+8
View File
@@ -237,6 +237,8 @@ export function EventModal({
relativeTo: null,
},
};
} else if (isEdit && event?.locations && Object.keys(event.locations).length > 0) {
data.locations = null;
}
if (recurrence !== "none") {
@@ -259,6 +261,10 @@ export function EventModal({
count: null,
until: null,
}];
} else if (isEdit && event?.recurrenceRules?.length) {
data.recurrenceRules = null;
if (event.recurrenceOverrides) data.recurrenceOverrides = null;
if (event.excludedRecurrenceRules) data.excludedRecurrenceRules = null;
}
if (alert !== "none") {
@@ -272,6 +278,8 @@ export function EventModal({
relatedTo: null,
},
};
} else if (isEdit && event?.alerts && Object.keys(event.alerts).length > 0) {
data.alerts = null;
}
if (attendees.length > 0 && currentUserEmails.length > 0) {