Skip to content
Permalink
Browse files

Set _componentChanged when decorating ATTENDEEs with X-APPLE-HOSTED-S…

…TATUS

git-svn-id: https://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk@15014 e27351fd-9f3e-4f54-a53b-843176b1656c
  • Loading branch information...
m0rgen committed Jul 28, 2015
1 parent 651031c commit 60184bee08370c570d96fbd776a3abb6cac13022
Showing with 23 additions and 4 deletions.
  1. +6 −3 txdav/caldav/datastore/sql.py
  2. +17 −1 txdav/caldav/datastore/test/test_sql.py
@@ -3512,13 +3512,16 @@ def decorateHostedStatus(self, component):
else:
status = "local"

prevValue = attendee.parameterValue(config.HostedStatus.Parameter)
if config.HostedStatus.Values[status]:
attendee.setParameter(
config.HostedStatus.Parameter,
config.HostedStatus.Values[status]
)
else:
attendee.removeParameter(config.HostedStatus.Parameter)
if attendee.parameterValue(config.HostedStatus.Parameter) != prevValue:
self._componentChanged = True


@inlineCallbacks
@@ -3798,17 +3801,17 @@ def _setComponentInternal(self, component, inserting=False, internal_state=Compo
# 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)

@@ -3455,7 +3455,7 @@ def test_setComponent_externalPrincipal(self):
calendar_name="calendar",
home="user01"
)
comp = yield cobj.component()
comp = yield cobj.componentForUser()
components = list(comp.subcomponents())

# Check attendees...
@@ -3470,6 +3470,22 @@ def test_setComponent_externalPrincipal(self):
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@example.com"])
external.removeParameter(config.HostedStatus.Parameter)
yield cobj.setComponent(comp)
self.assertTrue(cobj._componentChanged)

yield self.commit()

0 comments on commit 60184be

Please sign in to comment.
You can’t perform that action at this time.