[CalendarServer-changes] [14526] CalendarServer/branches/users/sagen/trashcan-5/txdav

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 6 21:42:58 PST 2015


Revision: 14526
          http://trac.calendarserver.org//changeset/14526
Author:   sagen at apple.com
Date:     2015-03-06 21:42:58 -0800 (Fri, 06 Mar 2015)
Log Message:
-----------
Allow a sharee to trash an event, which will go to the sharer's trash

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/sql.py
    CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql.py

Modified: CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/sql.py	2015-03-07 01:03:31 UTC (rev 14525)
+++ CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/sql.py	2015-03-07 05:42:58 UTC (rev 14526)
@@ -3928,7 +3928,7 @@
         sourceowner = self.calendar().viewerHome().uid()
         destowner = destination.viewerHome().uid()
 
-        if sourceowner != destowner:
+        if not destination.isTrash() and sourceowner != destowner:
             msg = "Calendar-to-calendar moves with different homes are not supported."
             log.debug(msg)
             raise InvalidResourceMove(msg)

Modified: CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql.py	2015-03-07 01:03:31 UTC (rev 14525)
+++ CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql.py	2015-03-07 05:42:58 UTC (rev 14526)
@@ -7661,10 +7661,8 @@
     @inlineCallbacks
     def toTrash(self):
         originalCollection = self._parentCollection._resourceID
-        trash = yield self._parentCollection._home.childWithName("trash")
+        trash = yield self._parentCollection.ownerHome().childWithName("trash")
         newName = str(uuid4())
-        # FIXME: if the sharee is deleting this resource, it needs to move to
-        # the sharer's trash instead
         yield self.moveTo(trash, name=newName)
         yield self._updateToTrashQuery.on(
             self._txn, originalCollection=originalCollection, trashed=datetime.datetime.utcnow(), resourceID=self._resourceID
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150306/48048331/attachment.html>


More information about the calendarserver-changes mailing list