launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00615
[Merge] lp:~gmb/launchpad/bug-618606 into lp:launchpad/devel
Graham Binns has proposed merging lp:~gmb/launchpad/bug-618606 into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers): code
Related bugs:
#618606 Add bug_subscription_level to the BugSubscriptionModel
https://bugs.launchpad.net/bugs/618606
This branch adds the bug_notification_level attribute to BugSubscription (this is already in the DB, just not in the model or the interface).
I've updated bugsubscriptions.txt to check that the default value of a new subscription is BugNotificationLevel.COMMENTS. As yet the attribute is unused, which is why I haven't exported it in the API.
--
https://code.launchpad.net/~gmb/launchpad/bug-618606/+merge/32761
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/bug-618606 into lp:launchpad/devel.
=== modified file 'lib/lp/bugs/doc/bugsubscription.txt'
--- lib/lp/bugs/doc/bugsubscription.txt 2010-08-02 17:48:13 +0000
+++ lib/lp/bugs/doc/bugsubscription.txt 2010-08-16 13:13:43 +0000
@@ -544,8 +544,7 @@
>>> bug.isSubscribed(foobar)
False
- >>> bug.subscribe(foobar, foobar)
- <BugSubscription at ...>
+ >>> subscription = bug.subscribe(foobar, foobar)
>>> bug.isSubscribed(foobar)
True
@@ -553,6 +552,12 @@
>>> bug.isSubscribed(foobar)
False
+By default, the bug_notification_level of the new subscription will be
+COMMENTS, so the user will receive all notifications about the bug.
+
+ >>> print subscription.bug_notification_level.title
+ Discussion
+
To unsubscribe from all dupes for a bug, call
IBug.unsubscribeFromDupes. This is useful because direct subscribers
from dupes are automatically subscribed to dupe targets, so we provide
=== modified file 'lib/lp/bugs/interfaces/bugsubscription.py'
--- lib/lp/bugs/interfaces/bugsubscription.py 2010-07-27 19:17:43 +0000
+++ lib/lp/bugs/interfaces/bugsubscription.py 2010-08-16 13:13:43 +0000
@@ -12,10 +12,12 @@
]
from zope.interface import Interface, Attribute
-from zope.schema import Int, Datetime
+from zope.schema import Int, Choice, Datetime
from canonical.launchpad import _
from canonical.launchpad.fields import PersonChoice
+
from lp.bugs.interfaces.bug import IBug
+from lp.registry.interfaces.structuralsubscription import BugNotificationLevel
from lazr.restful.declarations import (
REQUEST_USER, call_with, export_as_webservice_entry,
@@ -35,6 +37,12 @@
"e-mail address.")))
bug = exported(Reference(
IBug, title=_("Bug"), required=True, readonly=True))
+ bug_notification_level = Choice(
+ title=_("Bug notification level"), required=True,
+ vocabulary=BugNotificationLevel,
+ default=BugNotificationLevel.NOTHING,
+ description=_("The volume and type of bug notifications "
+ "this subscription will generate."))
date_created = exported(
Datetime(title=_('Date subscribed'), required=True, readonly=True))
subscribed_by = exported(PersonChoice(
=== modified file 'lib/lp/bugs/model/bugsubscription.py'
--- lib/lp/bugs/model/bugsubscription.py 2010-07-29 20:16:23 +0000
+++ lib/lp/bugs/model/bugsubscription.py 2010-08-16 13:13:43 +0000
@@ -12,10 +12,12 @@
from canonical.database.constants import UTC_NOW
from canonical.database.datetimecol import UtcDateTimeCol
+from canonical.database.enumcol import EnumCol
from canonical.database.sqlbase import SQLBase
from lp.bugs.interfaces.bugsubscription import IBugSubscription
from lp.registry.interfaces.person import validate_person
+from lp.registry.interfaces.structuralsubscription import BugNotificationLevel
class BugSubscription(SQLBase):
@@ -31,6 +33,10 @@
notNull=True
)
bug = ForeignKey(dbName='bug', foreignKey='Bug', notNull=True)
+ bug_notification_level = EnumCol(
+ enum=BugNotificationLevel,
+ default=BugNotificationLevel.COMMENTS,
+ notNull=True)
date_created = UtcDateTimeCol(notNull=True, default=UTC_NOW)
subscribed_by = ForeignKey(
dbName='subscribed_by', foreignKey='Person',