Fix bug 453145 - Using ctrl+s or 'Save' from menu in event dialog while editing a occurrence of a recurring event changes whole series. r=mschroeder
authorPhilipp Kewisch <mozilla@kewis.ch>
Mon, 22 Jun 2009 15:13:16 +0200
changeset 2912 e08745a3f275a6ec49c399341cff707a62ac03a8
parent 2911 b546a5072e6fc5b3add8b37faa9e78824760f6a8
child 2913 651d2736a008bd4a0cb0b12d4a4d43f6d2e5fd2b
push id2361
push usermozilla@kewis.ch
push dateMon, 22 Jun 2009 13:13:55 +0000
treeherdercomm-central@e08745a3f275 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmschroeder
bugs453145
Fix bug 453145 - Using ctrl+s or 'Save' from menu in event dialog while editing a occurrence of a recurring event changes whole series. r=mschroeder
calendar/base/content/dialogs/calendar-event-dialog.js
--- a/calendar/base/content/dialogs/calendar-event-dialog.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog.js
@@ -2162,17 +2162,27 @@ function onCommandSave(aIsClosing) {
 
     // XXX Do we want to disable the dialog or at least the save button until
     // the call is complete? This might help when the user tries to save twice
     // before the call is complete. In that case, we do need a progress bar and
     // the ability to cancel the operation though.
     var listener = {
         onOperationComplete: function(aCalendar, aStatus, aOpType, aId, aItem) {
             if (Components.isSuccessCode(aStatus)) {
-                window.calendarItem = aItem;
+                if (window.calendarItem.recurrenceId) {
+                    // TODO This workaround needs to be removed in bug 396182
+                    // We are editing an occurrence. Make sure that the returned
+                    // item is the same occurrence, not its parent item.
+                    let occ = aItem.recurrenceInfo
+                                   .getOccurrenceFor(window.calendarItem.recurrenceId);
+                    window.calendarItem = occ;
+                } else {
+                    // We are editing the parent item, no workarounds needed
+                    window.calendarItem = aItem;
+                }
             }
         }
     };
 
     // Let the caller decide how to handle the modified/added item. Only pass
     // the above item if we are not closing, otherwise the listener will be
     // missing its window afterwards.
     window.onAcceptCallback(item, calendar, originalItem, !aIsClosing && listener);