bodhi/controllers.py | 4 ++--
bodhi/model.py | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 88d39aac30319c2a2c6c3f2632aa76d4c8ec88aa
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Apr 28 16:38:42 2011 -0400
Add an email boolean to our comment API so services like AutoQA can choose not
to spam everyone when tests pass
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index fb1878f..e3e781a 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -1282,7 +1282,7 @@ class Root(controllers.RootController):
#@validate(validators={'karma': validators.Int()})
@validate(form=comment_form)
@identity.require(identity.not_anonymous())
- def comment(self, text, title, karma=0, tg_errors=None):
+ def comment(self, text, title, karma=0, tg_errors=None, email=True):
""" Add a comment to an update.
Arguments:
@@ -1314,7 +1314,7 @@ class Root(controllers.RootController):
else:
text = textwrap.TextWrapper(width=80,
break_long_words=False).fill(text)
- update.comment(text, karma)
+ update.comment(text, karma, email=email)
if request_format() == 'json':
return dict(update=update.__json__())
raise redirect(update.get_url())
diff --git a/bodhi/model.py b/bodhi/model.py
index 0e1fab7..b77d52e 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -800,7 +800,7 @@ class PackageUpdate(SQLObject):
color = '#00ff00' # green
return color
- def comment(self, text, karma=0, author=None, anonymous=False):
+ def comment(self, text, karma=0, author=None, anonymous=False, email=True):
""" Add a comment to this update, adjusting the karma
appropriately.
Each user has the ability to comment as much as they want, but only
@@ -897,7 +897,8 @@ class PackageUpdate(SQLObject):
mail.send(self.submitter, 'unstable', self)
# Send a notification to everyone that has commented on this update
- mail.send(self.people_to_notify(), 'comment', self)
+ if email:
+ mail.send(self.people_to_notify(), 'comment', self)
def unpush(self):
""" Move this update back to its dist-fX-updates-candidate tag
"""
Show replies by thread