Bug 752163 - Storage calendar events are not shown in views due to a corrupted event organizer. r=redDragon, a=philipp
authorMatthew Mecca <matthew.mecca@gmail.com>
Fri, 25 May 2012 23:44:09 -0400
changeset 11345 b1271b77793a6e2046722d783be66fee60d03049
parent 11344 40ca16a22853892c9ef1288a85c26b377c42c44b
child 11346 6a1d10115b3886a54695d7a3af951967ad08bf3a
push id509
push usermatthew.mecca@gmail.com
push dateSat, 26 May 2012 03:47:03 +0000
treeherdercomm-beta@b1271b77793a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersredDragon, philipp
bugs752163
Bug 752163 - Storage calendar events are not shown in views due to a corrupted event organizer. r=redDragon, a=philipp
calendar/base/modules/calProviderUtils.jsm
calendar/providers/storage/calStorageCalendar.js
--- a/calendar/base/modules/calProviderUtils.jsm
+++ b/calendar/base/modules/calProviderUtils.jsm
@@ -849,32 +849,32 @@ cal.ProviderBase.prototype = {
 
     // calISchedulingSupport: Implementation corresponding to our iTIP/iMIP support
     isInvitation: function cPB_isInvitation(aItem) {
         if (!this.mACLEntry || !this.mACLEntry.hasAccessControl) {
             // No ACL support - fallback to the old method
             let id = this.getProperty("organizerId");
             if (id) {
                 let org = aItem.organizer;
-                if (!org || (org.id.toLowerCase() == id.toLowerCase())) {
+                if (!org || !org.id || (org.id.toLowerCase() == id.toLowerCase())) {
                     return false;
                 }
                 return (aItem.getAttendeeById(id) != null);
             }
             return false;
         }
 
         let org = aItem.organizer;
-        if (!org) {
+        if (!org || !org.id) {
             // HACK
             // if we don't have an organizer, this is perhaps because it's an exception
             // to a recurring event. We check the parent item.
             if (aItem.parentItem) {
                 org = aItem.parentItem.organizer;
-                if (!org) return false;
+                if (!org || !org.id) return false;
             } else {
                 return false;
             }
         }
 
         // We check if :
         // - the organizer of the event is NOT within the owner's identities of this calendar
         // - if the one of the owner's identities of this calendar is in the attendees
--- a/calendar/providers/storage/calStorageCalendar.js
+++ b/calendar/providers/storage/calStorageCalendar.js
@@ -1664,20 +1664,25 @@ calStorageCalendar.prototype = {
                 this.setDateParamHelper(selectItem.params, "recurrence_id", item.recurrenceId);
             }
 
             try {
                 this.prepareStatement(selectItem);
                 selectItem.params.item_id = item.id;
                 while (selectItem.step()) {
                     var attendee = this.getAttendeeFromRow(selectItem.row);
-                    if (attendee.isOrganizer) {
-                        item.organizer = attendee;
+                    if (attendee && attendee.id) {
+                        if (attendee.isOrganizer) {
+                            item.organizer = attendee;
+                        } else {
+                            item.addAttendee(attendee);
+                        }
                     } else {
-                        item.addAttendee(attendee);
+                        cal.WARN("[calStorageCalendar] Skipping invalid attendee for item '" +
+                                 item.title + "' (" + item.id + ").");
                     }
                 }
             } catch (e) {
                 this.logError("Error getting attendees for item '" +
                               item.title + "' (" + item.id + ")!", e);
             } finally {
                 selectItem.reset();
             }