Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Commit

Permalink
fixes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
fredsmith committed May 29, 2015
1 parent 2c5ddf1 commit 59bb094
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions plugins/notify.py
Expand Up @@ -9,17 +9,16 @@ def send_notification(self, build_id, text):
notification_list = self.load("notify_{}".format(build_id), '')
self.say("{} BuildID: {}, Message: {}".format(notification_list, build_id, text))

@respond_to("^subscribe (@*)(?P<user>\w*) to (?P<build_id>\w*)")
@respond_to("^subscribe (@?)(?P<user>\w*) to (?P<build_id>\w*)")
def subscribe(self, message, user, build_id):
"""
subscribe [user] to [jobid]: request to be notified when builds complete
subscribe [user] to [buildid]: request to be notified when builds complete
"""
if user == "me":
user = message.sender.nick
else:
user = user.replace("@", "")

notification_list = "{} @{}".format(
self.load("notify_{}".format(build_id), ''),
self.load("notify_{}" + build_id, ''),
user)
self.save('notify_{}'.format(build_id), notification_list)
self.say("OK, I'll tell {} when I hear about {}".format(', '.join(notification_list.replace("@", "").split(" ")), build_id))
Expand Down

0 comments on commit 59bb094

Please sign in to comment.