[CalendarServer-changes] [11868] CalendarServer/trunk/txdav/caldav/datastore
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:21:17 PDT 2014
Revision: 11868
http://trac.calendarserver.org//changeset/11868
Author: cdaboo at apple.com
Date: 2013-11-01 11:02:11 -0700 (Fri, 01 Nov 2013)
Log Message:
-----------
No longer preserve attendee private comments.
Modified Paths:
--------------
CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py
CalendarServer/trunk/txdav/caldav/datastore/sql.py
CalendarServer/trunk/txdav/caldav/datastore/test/test_implicit.py
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py 2013-11-01 18:01:40 UTC (rev 11867)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py 2013-11-01 18:02:11 UTC (rev 11868)
@@ -471,16 +471,9 @@
pass
elif attendee_comment is None and private_comment is not None:
- # Remove all property parameters
- private_comment.removeAllParameters()
+ # We now remove the private comment on the organizer's side if the attendee removed it
+ to_component.removeProperty(private_comment)
- # Add default parameters
- private_comment.setParameter("X-CALENDARSERVER-ATTENDEE-REF", attendee.value())
- private_comment.setParameter("X-CALENDARSERVER-DTSTAMP", PyCalendarDateTime.getNowUTC().getText())
-
- # Set value empty
- private_comment.setValue("")
-
private_comment_changed = True
elif attendee_comment is not None and private_comment is None:
Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py 2013-11-01 18:01:40 UTC (rev 11867)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py 2013-11-01 18:02:11 UTC (rev 11868)
@@ -1736,20 +1736,23 @@
NB Do this before implicit scheduling as we don't want old clients to trigger scheduling when
the X- property is missing.
+
+ We now only preserve the "X-CALENDARSERVER-ATTENDEE-COMMENT" property. We will now allow clients
+ to delete the "X-CALENDARSERVER-PRIVATE-COMMENT" and treat that as a removal of the attendee
+ comment (which will trigger scheduling with the organizer to remove the comment on the organizer's
+ side).
"""
if config.Scheduling.CalDAV.get("EnablePrivateComments", True):
old_has_private_comments = not inserting and self.hasPrivateComment
new_has_private_comments = component.hasPropertyInAnyComponent((
- "X-CALENDARSERVER-PRIVATE-COMMENT",
"X-CALENDARSERVER-ATTENDEE-COMMENT",
))
if old_has_private_comments and not new_has_private_comments:
# Transfer old comments to new calendar
- log.debug("Private Comments properties were entirely removed by the client. Restoring existing properties.")
+ log.debug("Organizer private comment properties were entirely removed by the client. Restoring existing properties.")
old_calendar = (yield self.componentForUser())
component.transferProperties(old_calendar, (
- "X-CALENDARSERVER-PRIVATE-COMMENT",
"X-CALENDARSERVER-ATTENDEE-COMMENT",
))
Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_implicit.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_implicit.py 2013-11-01 18:01:40 UTC (rev 11867)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_implicit.py 2013-11-01 18:02:11 UTC (rev 11868)
@@ -478,9 +478,9 @@
@inlineCallbacks
- def test_validation_preservePrivateComments(self):
+ def test_validation_noPreservePrivateComments(self):
"""
- Test that resource private comments are restored.
+ Test that attendee private comments are no longer restored.
"""
data1 = """BEGIN:VCALENDAR
@@ -524,12 +524,65 @@
calendar_resource = (yield self.calendarObjectUnderTest(name="test.ics", home="user01",))
calendar1 = (yield calendar_resource.component())
calendar1 = str(calendar1).replace("\r\n ", "")
- self.assertTrue("X-CALENDARSERVER-PRIVATE-COMMENT:My Comment" in calendar1)
+ self.assertFalse("X-CALENDARSERVER-PRIVATE-COMMENT:My Comment" in calendar1)
self.assertTrue("SUMMARY:Changed" in calendar1)
yield self.commit()
@inlineCallbacks
+ def test_validation_preserveOrganizerPrivateComments(self):
+ """
+ Test that organizer private comments are restored.
+ """
+
+ data1 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-organizer
+DTSTAMP:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+X-CALENDARSERVER-ATTENDEE-COMMENT;X-CALENDARSERVER-ATTENDEE-REF="urn:uuid:user01";
+ X-CALENDARSERVER-DTSTAMP=20131101T100000Z:Someone else's comment
+END:VEVENT
+END:VCALENDAR
+"""
+
+ calendar_collection = (yield self.calendarUnderTest(home="user01"))
+ calendar = Component.fromString(data1)
+ yield calendar_collection.createCalendarObjectWithName("test.ics", calendar)
+ yield self.commit()
+
+ data2 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-organizer
+DTSTAMP:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+SUMMARY:Changed
+END:VEVENT
+END:VCALENDAR
+"""
+
+ calendar_resource = (yield self.calendarObjectUnderTest(name="test.ics", home="user01",))
+ calendar = Component.fromString(data2)
+ txn = self.transactionUnderTest()
+ txn._authz_uid = "user01"
+ yield calendar_resource.setComponent(calendar)
+ yield self.commit()
+
+ calendar_resource = (yield self.calendarObjectUnderTest(name="test.ics", home="user01",))
+ calendar1 = (yield calendar_resource.component())
+ calendar1 = str(calendar1).replace("\r\n ", "")
+ self.assertTrue("X-CALENDARSERVER-ATTENDEE-COMMENT;X-CALENDARSERVER-ATTENDEE-REF=\"urn:uuid:user01\";X-CALENDARSERVER-DTSTAMP=20131101T100000Z:Someone else's comment" in calendar1)
+ self.assertTrue("SUMMARY:Changed" in calendar1)
+ yield self.commit()
+
+
+ @inlineCallbacks
def test_validation_replaceMissingToDoProperties_OrganizerAttendee(self):
"""
Test that missing scheduling properties in VTODOs are recovered.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/92da5d6a/attachment.html>
More information about the calendarserver-changes
mailing list