[CalendarServer-changes] [15014] CalendarServer/trunk/txdav/caldav/datastore

source_changes at macosforge.org source_changes at macosforge.org
Tue Jul 28 16:22:22 PDT 2015


Revision: 15014
          http://trac.calendarserver.org//changeset/15014
Author:   sagen at apple.com
Date:     2015-07-28 16:22:22 -0700 (Tue, 28 Jul 2015)
Log Message:
-----------
Set _componentChanged when decorating ATTENDEEs with X-APPLE-HOSTED-STATUS

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/sql.py
    CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py	2015-07-28 19:07:46 UTC (rev 15013)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py	2015-07-28 23:22:22 UTC (rev 15014)
@@ -3512,6 +3512,7 @@
                 else:
                     status = "local"
 
+                prevValue = attendee.parameterValue(config.HostedStatus.Parameter)
                 if config.HostedStatus.Values[status]:
                     attendee.setParameter(
                         config.HostedStatus.Parameter,
@@ -3519,6 +3520,8 @@
                     )
                 else:
                     attendee.removeParameter(config.HostedStatus.Parameter)
+                if attendee.parameterValue(config.HostedStatus.Parameter) != prevValue:
+                    self._componentChanged = True
 
 
     @inlineCallbacks
@@ -3798,17 +3801,17 @@
             # implicit code below will set _componentChanged
             yield self.replaceMissingToDoProperties(component, inserting, internal_state)
 
-            # Handle sharing dropbox normalization
+            # Handle sharing dropbox normalization (and set _componentChanged)
             yield self.dropboxPathNormalization(component)
 
             # Pre-process managed attachments
             if internal_state == ComponentUpdateState.NORMAL:
                 managed_copied, managed_removed = (yield self.resourceCheckAttachments(component, inserting))
 
-            # Default/duplicate alarms
+            # Default/duplicate alarms (and set _componentChanged)
             self.processAlarms(component, inserting)
 
-            # Process hosted status
+            # Process hosted status (and set _componentChanged)
             if config.HostedStatus.Enabled:
                 yield self.decorateHostedStatus(component)
 

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2015-07-28 19:07:46 UTC (rev 15013)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2015-07-28 23:22:22 UTC (rev 15014)
@@ -3455,7 +3455,7 @@
             calendar_name="calendar",
             home="user01"
         )
-        comp = yield cobj.component()
+        comp = yield cobj.componentForUser()
         components = list(comp.subcomponents())
 
         # Check attendees...
@@ -3470,7 +3470,23 @@
             external.parameterValue(config.HostedStatus.Parameter),
             config.HostedStatus.Values["external"]
         )
+        yield self.commit()
 
+        cobj = yield self.calendarObjectUnderTest(
+            name="external.ics",
+            calendar_name="calendar",
+            home="user01"
+        )
+        comp = yield cobj.componentForUser()
+        comp = comp.duplicate()
+        main = comp.mainComponent()
+        # Remove the parameter so it gets added back and then we can check
+        # _componentChanged
+        external = main.getAttendeeProperty(["mailto:someone_external at example.com"])
+        external.removeParameter(config.HostedStatus.Parameter)
+        yield cobj.setComponent(comp)
+        self.assertTrue(cobj._componentChanged)
+
         yield self.commit()
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150728/f7f69f61/attachment.html>


More information about the calendarserver-changes mailing list