Revision
6467
Author
sagen@apple.com
Date
2010-10-25 19:02:17 -0700 (Mon, 25 Oct 2010)

Log Message

If organizer is also an attendee, substitute the token email address within the attendee property as well as within the organizer property

Modified Paths

Diff

Modified: CalendarServer/trunk/twistedcaldav/mail.py (6466 => 6467)


--- CalendarServer/trunk/twistedcaldav/mail.py	2010-10-25 20:21:13 UTC (rev 6466)
+++ CalendarServer/trunk/twistedcaldav/mail.py	2010-10-26 02:02:17 UTC (rev 6467)
@@ -883,12 +883,15 @@
             pre, post = serverAddress.split('@')
             addressWithToken = "%s+%s@%s" % (pre, token, post)
 
-            calendar.getOrganizerProperty().setValue("mailto:%s" %
-                (addressWithToken,))
+            organizerProperty = calendar.getOrganizerProperty()
+            organizerValue = organizerProperty.value()
+            organizerProperty.setValue("mailto:%s" % (addressWithToken,))
 
-            originatorAttendee = calendar.getAttendeeProperty([originator])
-            if originatorAttendee is not None:
-                originatorAttendee.setValue("mailto:%s" % (addressWithToken,))
+            # If the organizer is also an attendee, update that attendee value
+            # to match
+            organizerAttendeeProperty = calendar.getAttendeeProperty([organizerValue])
+            if organizerAttendeeProperty is not None:
+                organizerAttendeeProperty.setValue("mailto:%s" % (addressWithToken,))
 
             # The email's From will include the originator's real name email
             # address if available.  Otherwise it will be the server's email

Modified: CalendarServer/trunk/twistedcaldav/test/test_mail.py (6466 => 6467)


--- CalendarServer/trunk/twistedcaldav/test/test_mail.py	2010-10-25 20:21:13 UTC (rev 6466)
+++ CalendarServer/trunk/twistedcaldav/test/test_mail.py	2010-10-26 02:02:17 UTC (rev 6467)
@@ -259,6 +259,15 @@
                 self.assertEquals(actualReplyTo,
                     "server+%s@example.com" % (token,))
 
+                # Make sure attendee property for organizer exists and matches
+                # the CUA of the organizer property
+                orgValue = actualCalendar.getOrganizerProperty().value()
+                self.assertEquals(
+                    orgValue,
+                    actualCalendar.getAttendeeProperty([orgValue]).value()
+                )
+
+
             else: # Reply only -- the attendee is local, and server is sending
                   # reply to remote organizer