From 55c3a5584beef85dbecd909288a712dc7f294c8e Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Mon, 6 Nov 2023 16:56:09 +0100 Subject: [PATCH 1/3] #1306: Fix the reset after stopping a recurrence --- www/common/outer/calendar.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/www/common/outer/calendar.js b/www/common/outer/calendar.js index e10db796f..43645a52a 100644 --- a/www/common/outer/calendar.js +++ b/www/common/outer/calendar.js @@ -896,7 +896,14 @@ define([ if (['one','from'].includes(type.which) && !data.rawData.isOrigin) { cleanAfter(type.when); } else { - update = ev.recUpdate = RECUPDATE; + if (changes.recurrenceRule.until) { + // Remove changes after the last iteration + cleanAfter(changes.recurrenceRule.until); + } + if (changes.recurrenceRule === "") { + // Reset special cases when removing recurrence + update = ev.recUpdate = RECUPDATE; + } } } From 36499846c9bb1637e8457dbba287208e6d61a70f Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Mon, 6 Nov 2023 17:22:39 +0100 Subject: [PATCH 2/3] #1306: Consistent behavior when resuming recurrence --- www/common/outer/calendar.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/common/outer/calendar.js b/www/common/outer/calendar.js index 43645a52a..ea7a21a95 100644 --- a/www/common/outer/calendar.js +++ b/www/common/outer/calendar.js @@ -893,8 +893,9 @@ define([ // Update recurrence rule. We may create a new event here var dontSendUpdate = false; if (typeof(changes.recurrenceRule) !== "undefined") { - if (['one','from'].includes(type.which) && !data.rawData.isOrigin) { - cleanAfter(type.when); + if (type.which === "from" && !data.rawData.isOrigin) { + // Clean from the day after the event (it otherwise wipes too much) + cleanAfter(type.when + 86400000); } else { if (changes.recurrenceRule.until) { // Remove changes after the last iteration From bcf33060f8d1c983698d6eee5f706c316f206ac1 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Thu, 9 Nov 2023 17:10:31 +0100 Subject: [PATCH 3/3] #1306: Cleaning up the code - Put special cases at the beginning of the conditional branching --- www/common/outer/calendar.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/www/common/outer/calendar.js b/www/common/outer/calendar.js index ea7a21a95..450b32602 100644 --- a/www/common/outer/calendar.js +++ b/www/common/outer/calendar.js @@ -893,18 +893,16 @@ define([ // Update recurrence rule. We may create a new event here var dontSendUpdate = false; if (typeof(changes.recurrenceRule) !== "undefined") { - if (type.which === "from" && !data.rawData.isOrigin) { - // Clean from the day after the event (it otherwise wipes too much) - cleanAfter(type.when + 86400000); + if (type.which === "all" && changes.recurrenceRule.until) { + // Remove changes after the last iteration + cleanAfter(changes.recurrenceRule.until); + } + else if (['one','from'].includes(type.which) && !data.rawData.isOrigin) { + // Start cleaning after the event (otherwise it resets the current event) + cleanAfter(type.when + 1); } else { - if (changes.recurrenceRule.until) { - // Remove changes after the last iteration - cleanAfter(changes.recurrenceRule.until); - } - if (changes.recurrenceRule === "") { - // Reset special cases when removing recurrence - update = ev.recUpdate = RECUPDATE; - } + // Else wipe everything + update = ev.recUpdate = RECUPDATE; } }