From 26753b7d4a6bd6938a84f7afe60d99ef5babc869 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 18 2015 11:04:26 +0000 Subject: When adding a tag to an issue, notify redis if asked With this change, when a tag is added on an issue, if there is a redis connection available, it will queue a message information about which tag(s) was/were added to the channel of this specific issue. --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index e921de3..ee781fc 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -193,7 +193,7 @@ def add_issue_comment(session, issue, comment, user, ticketfolder, return 'Comment added' -def add_issue_tag(session, issue, tags, user, ticketfolder): +def add_issue_tag(session, issue, tags, user, ticketfolder, redis=None): ''' Add a tag to an issue. ''' user_obj = __get_user(session, user) @@ -241,6 +241,9 @@ def add_issue_tag(session, issue, tags, user, ticketfolder): ) ) + if redis: + redis.publish(issue.uid, json.dumps({'added_tags': added_tags})) + if added_tags: return 'Tag added: %s' % ', '.join(added_tags) else: