[CalendarServer-changes] [12024] CalendarServer/trunk/txdav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:20:47 PDT 2014
Revision: 12024
http://trac.calendarserver.org//changeset/12024
Author: sagen at apple.com
Date: 2013-12-03 12:50:29 -0800 (Tue, 03 Dec 2013)
Log Message:
-----------
Use lower-priority notifications for Inbox item deletions
Modified Paths:
--------------
CalendarServer/trunk/txdav/caldav/datastore/sql.py
CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
CalendarServer/trunk/txdav/common/datastore/sql.py
Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py 2013-12-03 20:48:51 UTC (rev 12023)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py 2013-12-03 20:50:29 UTC (rev 12024)
@@ -2688,6 +2688,19 @@
yield scheduler.doImplicitScheduling()
+ def removeNotifyCategory(self):
+ """
+ Indicates what category to use when determining the priority of push
+ notifications when this object is removed.
+
+ @returns: The "inbox" category if this object is in the inbox, otherwise
+ the "default" category
+ @rtype: L{ChangeCategory}
+ """
+ return (ChangeCategory.inbox if self._calendar.isInbox() else
+ ChangeCategory.default)
+
+
@classproperty
def _recurrenceMinMaxByIDQuery(cls): #@NoSelf
"""
Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py 2013-12-03 20:48:51 UTC (rev 12023)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py 2013-12-03 20:50:29 UTC (rev 12024)
@@ -64,6 +64,7 @@
CommonCommonTests
from txdav.common.icommondatastore import NoSuchObjectResourceError
from txdav.xml.rfc2518 import GETContentLanguage, ResourceType
+from txdav.idav import ChangeCategory
import datetime
@@ -915,6 +916,32 @@
@inlineCallbacks
+ def test_removeNotifyCategoryInbox(self):
+ """
+ Inbox object removal should be categorized as ChangeCategory.inbox
+ """
+ home = yield self.homeUnderTest()
+ inbox = yield home.createCalendarWithName("inbox")
+ component = VComponent.fromString(test_event_text)
+ inboxItem = yield inbox.createCalendarObjectWithName("inbox.ics", component)
+ self.assertEquals(ChangeCategory.inbox, inboxItem.removeNotifyCategory())
+ yield self.commit()
+
+
+ @inlineCallbacks
+ def test_removeNotifyCategoryNonInbox(self):
+ """
+ Non-Inbox object removal should be categorized as ChangeCategory.default
+ """
+ home = yield self.homeUnderTest()
+ nonInbox = yield home.createCalendarWithName("noninbox")
+ component = VComponent.fromString(test_event_text)
+ nonInboxItem = yield nonInbox.createCalendarObjectWithName("inbox.ics", component)
+ self.assertEquals(ChangeCategory.default, nonInboxItem.removeNotifyCategory())
+ yield self.commit()
+
+
+ @inlineCallbacks
def test_directShareCreateConcurrency(self):
"""
Test that two concurrent attempts to create a direct shared calendar
Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py 2013-12-03 20:48:51 UTC (rev 12023)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py 2013-12-03 20:50:29 UTC (rev 12024)
@@ -4322,7 +4322,7 @@
if self._objectNames and child.name() in self._objectNames:
self._objectNames.remove(child.name())
yield self._deleteRevision(child.name())
- yield self.notifyChanged()
+ yield self.notifyChanged(category=child.removeNotifyCategory())
@classproperty
@@ -5064,6 +5064,18 @@
self._notificationData = None
+ def removeNotifyCategory(self):
+ """
+ Indicates what category to use when determining the priority of push
+ notifications when this object is removed.
+
+ @returns: The "default" category (but should be overridden to return
+ values such as "inbox")
+ @rtype: L{ChangeCategory}
+ """
+ return ChangeCategory.default
+
+
def uid(self):
return self._uid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/4a158307/attachment.html>
More information about the calendarserver-changes
mailing list