Bug 1180413 - Attendee list in event dialog should not be comma separated;r=philipp
authorMakeMyDay <makemyday@gmx-topmail.de>
Sat, 04 Jul 2015 19:28:36 +0200
changeset 23041 7c6189f9d917688fbe1da0a91124774b817e8aba
parent 23040 77b709d65ee6c747e96cb50121491083bc453aa2
child 23042 e30a4f7f6a2fb0fbbf943f01b46fbfc73fdf81a8
push idunknown
push userunknown
push dateunknown
reviewersphilipp
bugs1180413
Bug 1180413 - Attendee list in event dialog should not be comma separated;r=philipp
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
@@ -3465,49 +3465,34 @@ function updateAttendees() {
         attendeeRow.removeAttribute('collapsed');
         if (isEvent(window.calendarItem)) { // sending email invitations currently only supported for events
             attendeeRow2.removeAttribute('collapsed');
         } else {
             attendeeRow2.setAttribute('collapsed', 'true');
         }
 
         let attendeeNames = [];
-        let attendeeEmails = [];
-        let numAttendees = window.attendees.length;
-        let emailRE = new RegExp("^mailto:(.*)", "i");
-        for (let i = 0; i < numAttendees; i++) {
-            let attendee = window.attendees[i];
-            let name = attendee.commonName;
-            if (name && name.length) {
-                attendeeNames.push(name);
-                let email = attendee.id;
-                if (email && email.length) {
-                    if (emailRE.test(email)) {
-                        name += ' <' + RegExp.$1 + '>';
-                    } else {
-                        name += ' <' + email + '>';
-                    }
-                    attendeeEmails.push(name);
-                }
-            } else if (attendee.id && attendee.id.length) {
-                let email = attendee.id;
-                if (emailRE.test(email)) {
-                    attendeeNames.push(RegExp.$1);
-                } else {
-                    attendeeNames.push(email);
-                }
-            } else {
-                continue;
+        let attendeeTooltip = [];
+        let pushAttendees = function (aAttendee) {
+            let name = aAttendee.commonName || "";
+            if (name.startsWith('"') && name.endsWith('"')) {
+                name.slice(1, -1);
+            }
+            let email = cal.removeMailTo(aAttendee.id || "");
+            if (email.length) {
+                attendeeNames.push(name.length ? name : email);
+                attendeeTooltip.push(name.length ? name + '<' + email + '>' : email);
             }
         }
+        window.attendees.forEach(pushAttendees);
 
         let attendeeList = document.getElementById("attendee-list");
         let callback = function func() {
-            attendeeList.setAttribute('value', attendeeNames.join(', '));
-            attendeeList.setAttribute('tooltiptext', attendeeEmails.join(', '));
+            attendeeList.setAttribute('value', attendeeNames.join('; '));
+            attendeeList.setAttribute('tooltiptext', attendeeTooltip.join('\n'));
         };
         setTimeout(callback, 1);
     } else {
         attendeeRow.setAttribute('collapsed', 'true');
         attendeeRow2.setAttribute('collapsed', 'true');
     }
 }