bodhi/controllers.py | 1 + bodhi/model.py | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-)
New commits: commit 9eedebae669833777ceb25282cfb56ab7b992f6b Author: Luke Macken lmacken@redhat.com Date: Wed Mar 17 17:27:29 2010 -0400
Add a PackageUpdate.people_to_notify method, and make sure that we notify more than just bodhi admins when an update is deleted.
diff --git a/bodhi/controllers.py b/bodhi/controllers.py index cabc879..c7deb1e 100644 --- a/bodhi/controllers.py +++ b/bodhi/controllers.py @@ -449,6 +449,7 @@ class Root(controllers.RootController): update.destroySelf() flash_log(msg) mail.send_admin('deleted', update) + mail.send(update.people_to_notify(), 'deleted', update) else: flash_log("Cannot delete a pushed update") except SQLObjectNotFound: diff --git a/bodhi/model.py b/bodhi/model.py index b002b6a..c76fcdd 100644 --- a/bodhi/model.py +++ b/bodhi/model.py @@ -762,16 +762,7 @@ class PackageUpdate(SQLObject): mail.send_admin('critpath_approved', self)
# Send a notification to everyone that has commented on this update - people = set() - people.add(self.submitter) - # Until we can differentiate between maintainers and committers - #for person in self.get_maintainers(): - # people.add(person) - for comment in self.comments: - if comment.anonymous or comment.author == 'bodhi': - continue - people.add(comment.author.split()[0]) - mail.send(people, 'comment', self) + mail.send(self.people_to_notify(), 'comment', self)
def unpush(self): """ Move this update back to its dist-fX-updates-candidate tag """ @@ -913,6 +904,20 @@ class PackageUpdate(SQLObject): 'critpath.num_admin_approvals', 2) and \ self.karma >= config.get('critpath.min_karma', 2)
+ def people_to_notify(self): + """ Return a list of people to notify when this update changes """ + people = set() + people.add(self.submitter) + for comment in self.comments: + if comment.anonymous or comment.author == 'bodhi': + continue + people.add(comment.author.split()[0]) + # This won't differentiate between maintainers and committers. + # Do we want to spam *all* committers of a package for all + # of it's updates? If so, + #for person in self.get_maintainers(): + # people.add(person) + return people
class Comment(SQLObject): timestamp = DateTimeCol(default=datetime.utcnow)