[CalendarServer-changes] [14662] CalendarServer/trunk/txdav
source_changes at macosforge.org
source_changes at macosforge.org
Mon Apr 6 09:44:14 PDT 2015
Revision: 14662
http://trac.calendarserver.org//changeset/14662
Author: cdaboo at apple.com
Date: 2015-04-06 09:44:14 -0700 (Mon, 06 Apr 2015)
Log Message:
-----------
Make sure inconsequential change to item in trash leaves it in the trash.
Modified Paths:
--------------
CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
CalendarServer/trunk/txdav/common/datastore/test/test_trash.py
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2015-04-04 18:06:01 UTC (rev 14661)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2015-04-06 16:44:14 UTC (rev 14662)
@@ -372,6 +372,7 @@
# Reset state to make it look like a new iTIP being processed
self.recipient_calendar = None
self.recipient_calendar_resource = None
+ self.recipient_in_trash = False
self.new_resource = True
else:
raise ImplicitProcessorException("5.3;Organizer change not allowed")
@@ -457,13 +458,18 @@
@return: C{tuple} of (processed, auto-processed, store inbox item, changes)
"""
- # If we have a recipient item in the trash, remove it right now so that we treat the iTIP message as a new
- # invite.
- if not self.new_resource and self.recipient_in_trash:
+ # Check if the incoming data has the recipient declined in all instances.
+ attendees = self.message.getAttendeeProperties((self.recipient.cuaddr,))
+ all_declined = all([attendee.parameterValue("PARTSTAT", "NEEDS-ACTION") == "DECLINED" for attendee in attendees])
+
+ # If we have a recipient item in the trash, and the incoming message has at least one undeclined partstat, then remove the trash
+ # item right now so that we treat the iTIP message as a new invite.
+ if not self.new_resource and self.recipient_in_trash and not all_declined:
yield self.deleteCalendarResource(self.recipient_calendar_resource)
# Reset state to make it look like a new iTIP being processed
self.recipient_calendar = None
self.recipient_calendar_resource = None
+ self.recipient_in_trash = False
self.new_resource = True
# If there is no existing copy, then look for default calendar and copy it here
@@ -471,8 +477,7 @@
# Check if the incoming data has the recipient declined in all instances. In that case we will not create
# a new resource as chances are the recipient previously deleted the resource and we want to keep it deleted.
- attendees = self.message.getAttendeeProperties((self.recipient.cuaddr,))
- if all([attendee.parameterValue("PARTSTAT", "NEEDS-ACTION") == "DECLINED" for attendee in attendees]):
+ if all_declined:
log.debug("ImplicitProcessing - originator '%s' to recipient '%s' processing METHOD:REQUEST, UID: '%s' - ignoring all declined" % (self.originator.cuaddr, self.recipient.cuaddr, self.uid))
returnValue((True, False, False, None,))
@@ -544,8 +549,9 @@
# Only store inbox item when reply is not sent or always for users
store_inbox = store_inbox or self.recipient.record.getCUType() == "INDIVIDUAL"
else:
+ # Do not store inbox item if the resource is remaining in the trash
send_reply = False
- store_inbox = True
+ store_inbox = not self.recipient_in_trash
# Let the store know that no time-range info has changed for a refresh (assuming that
# no auto-accept changes were made)
Modified: CalendarServer/trunk/txdav/common/datastore/test/test_trash.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/test/test_trash.py 2015-04-04 18:06:01 UTC (rev 14661)
+++ CalendarServer/trunk/txdav/common/datastore/test/test_trash.py 2015-04-06 16:44:14 UTC (rev 14662)
@@ -568,8 +568,8 @@
data = yield self._getResourceData(txn, "user02", "calendar", "")
self.assertTrue("PARTSTAT=NEEDS-ACTION" in data)
- resource = yield self._getResource(txn, "user01", "inbox", "")
- yield resource.remove()
+ resourceNames = yield self._getResourceNames(txn, "user01", "inbox")
+ self.assertEqual(len(resourceNames), 0)
yield txn.commit()
@@ -2019,7 +2019,7 @@
txn = self.store.newTransaction()
home1 = yield txn.calendarHomeWithUID("user01", create=True)
collection = yield home1.childWithName("calendar")
- resource = yield collection.createObjectResourceWithName(
+ yield collection.createObjectResourceWithName(
"test.ics",
Component.allFromString(organizer1_data)
)
@@ -2155,7 +2155,6 @@
txn = self.store.newTransaction()
home = yield self._homeForUser(txn, "user01")
yield home.getTrash(create=True) # force loading trash
- calendar = yield self._collectionForUser(txn, "user01", "calendar")
calendars = yield home.calendars(onlyInTrash=False)
self.assertEquals(
set([c.name() for c in calendars]),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150406/c47c76a2/attachment.html>
More information about the calendarserver-changes
mailing list