Repository: fedora-infra/bodhi

Issue:
misleading notification for automatic karma pushes
If the karma threshold is reached and the update is automatically pushed, the notification says that the last person giving karma submitted the update for stable. See for example [this i3 update](https://bodhi.fedoraproject.org/updates/FEDORA-2015-13445), which says:

> This update has been submitted for stable by thofmann. 

I only added karma, I did not submit anything.
#### How to reproduce
1. Find an update in testing which needs +1 karma to reach the threshold, and with automatic pushing enabled
2. add +1 karma



Discussion:
This should be a simple string change.  Thanks for reporting!


Resolving patch:
diff --git a/bodhi/masher.py b/bodhi/masher.py
--- a/bodhi/masher.py
+++ b/bodhi/masher.py
@@ -355,7 +355,7 @@ def work(self):
             success = True
             self.remove_state()
             self.unlock_updates()
-            self.check_karma_thresholds()
+            self.check_all_karma_thresholds()
         except:
             self.log.exception('Exception in MasherThread(%s)' % self.id)
             self.save_state()
@@ -381,7 +381,7 @@ def unlock_updates(self):
             update.locked = False
         self.db.flush()
 
-    def check_karma_thresholds(self):
+    def check_all_karma_thresholds(self):
         """
         If we just pushed testing updates see if any of them now meet either of
         the karma thresholds
@@ -391,7 +391,7 @@ def check_karma_thresholds(self):
                      'thresholds during the push')
             for update in self.updates:
                 try:
-                    update.check_karma_thresholds(username=u'bodhi')
+                    update.check_karma_thresholds(agent=u'bodhi')
                 except BodhiException:
                     self.log.exception('Problem checking karma thresholds')
 
diff --git a/bodhi/models/models.py b/bodhi/models/models.py
--- a/bodhi/models/models.py
+++ b/bodhi/models/models.py
@@ -1377,7 +1377,7 @@ def comment(self, text, karma=0, author=None, anonymous=False,
 
             if check_karma and author not in config.get('system_users').split():
                 try:
-                    self.check_karma_thresholds(author)
+                    self.check_karma_thresholds('bodhi')
                 except LockedUpdateException:
                     pass
                 except BodhiException as e:
@@ -1555,13 +1555,13 @@ def check_requirements(self, session, settings):
 
         return True, "All checks pass."
 
-    def check_karma_thresholds(self, username):
+    def check_karma_thresholds(self, agent):
         """Check if we have reached either karma threshold, and call set_request if necessary"""
         if not self.locked:
             if self.status is UpdateStatus.testing:
                 if self.stable_karma not in (0, None) and self.karma >= self.stable_karma:
                     log.info("Automatically marking %s as stable" % self.title)
-                    self.set_request(UpdateRequest.stable, username)
+                    self.set_request(UpdateRequest.stable, agent)
                     self.request = UpdateRequest.stable
                     self.date_pushed = None
                     notifications.publish(


Test patch: