From cd8631e2add9b4cdbae50b85b34608cbd22f9773 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 28 2017 09:23:21 +0000 Subject: Do not log on fedmsg edition to private comment Fixes https://pagure.io/pagure/issue/1989 --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index e48e19e..7a68975 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ - (c) 2014-2016 - Copyright Red Hat Inc + (c) 2014-2017 - Copyright Red Hat Inc Authors: Pierre-Yves Chibon @@ -1162,6 +1162,7 @@ def edit_comment(session, parent, comment, user, topic = 'unknown' key = 'unknown' id_ = 'unknown' + private = False if parent.isa == 'pull-request': topic = 'pull-request.comment.edited' key = 'pullrequest' @@ -1170,21 +1171,23 @@ def edit_comment(session, parent, comment, user, topic = 'issue.comment.edited' key = 'issue' id_ = 'issue_id' + private = parent.private - pagure.lib.notify.log( - parent.project, - topic=topic, - msg={ - key: parent.to_json(public=True, with_comments=False), - 'project': parent.project.to_json(public=True), - 'comment': comment.to_json(public=True), - 'agent': user_obj.username, - }, - redis=REDIS, - ) + if not private: + pagure.lib.notify.log( + parent.project, + topic=topic, + msg={ + key: parent.to_json(public=True, with_comments=False), + 'project': parent.project.to_json(public=True), + 'comment': comment.to_json(public=True), + 'agent': user_obj.username, + }, + redis=REDIS, + ) if REDIS: - if parent.isa == 'issue' and comment.parent.private: + if private: REDIS.publish('pagure.%s' % comment.parent.uid, json.dumps({ 'comment_updated': 'private', 'comment_id': comment.id,