Fix bug 815151 - Invitation replies are not shown (REPLY method, sender is null) (regression). r=mmecca,a=philipp
authorPhilipp Kewisch <mozilla@kewis.ch>
Mon, 26 Nov 2012 16:44:22 +0100
changeset 13614 0dc051fb48ccbcde93861adaa2699cb036f8aa6b
parent 13613 2e776ed93daa3803af219b8b149374c8cb60123c
child 13615 a38bc62c8484328996fe339bb62b7e02887d7dc5
push id32
push usermatthew.mecca@gmail.com
push dateFri, 08 Feb 2013 20:54:18 +0000
reviewersmmecca, philipp
bugs815151
Fix bug 815151 - Invitation replies are not shown (REPLY method, sender is null) (regression). r=mmecca,a=philipp
calendar/lightning/components/lightningTextCalendarConverter.js
--- a/calendar/lightning/components/lightningTextCalendarConverter.js
+++ b/calendar/lightning/components/lightningTextCalendarConverter.js
@@ -89,25 +89,34 @@ ltnMimeConverter.prototype = {
                     break;
                 case "CANCEL":
                     header = cal.calGetString("lightning",
                                               "itipCancelBody",
                                               [organizerString, summary],
                                               "lightning");
                     break;
                 case "REPLY": {
-                    // Generate proper body from my participation status
-                    let sender = cal.getInvitedAttendee(item);
-                    let statusString = (sender.participationStatus == "DECLINED" ?
-                        "itipReplyBodyDecline": "itipReplyBodyAccept");
+                    // This is a reply received from someone else, there should
+                    // be just one attendee, the attendee that replied. If
+                    // there is more than one attendee, just take the first so
+                    // code doesn't break here.
+                    let attendees = item.getAttendees({});
+                    if (attendees && attendees.length >= 1) {
+                        let sender = attendees[0];
+                        let statusString = (sender.participationStatus == "DECLINED" ?
+                                            "itipReplyBodyDecline" :
+                                            "itipReplyBodyAccept");
 
-                    header = cal.calGetString("lightning",
-                                              statusString,
-                                              [sender],
-                                              "lightning");
+                        header = cal.calGetString("lightning",
+                                                  statusString,
+                                                  [sender.toString()],
+                                                  "lightning");
+                    } else {
+                        header = "";
+                    }
                     break;
                 }
             }
         }
 
         if (!header) {
             header = cal.calGetString("lightning", "imipHtml.header", null, "lightning");
         }