From d86a5cbe003055f66de62302a7cf49db28037c68 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Mar 25 2019 18:02:03 +0000 Subject: Only synchronize issues when projects opt-in. By request. This should make it so that no repos synchronize comments by default, but only when the `comments` field in their downstream dict is set to `True`. --- diff --git a/sync2jira/downstream.py b/sync2jira/downstream.py index 9b34cb8..6cb14be 100644 --- a/sync2jira/downstream.py +++ b/sync2jira/downstream.py @@ -188,9 +188,13 @@ def _create_jira_issue(client, issue, config): remote_link = dict(url=issue.url, title=remote_link_title) _attach_link(client, downstream, remote_link) - log.info(" Adding %i comments." % len(issue.comments)) - for comment in issue.comments: - client.add_comment(downstream, _comment_format(comment)) + + # Only synchronize comments for listings that op-in + if issue.downstream.get('comments'): + log.info(" Adding %i comments." % len(issue.comments)) + for comment in issue.comments: + client.add_comment(downstream, _comment_format(comment)) + return downstream @@ -257,6 +261,11 @@ def sync_with_jira(issue, config): existing = _get_existing_jira_issue(client, issue, config) if existing: log.info(" Found existing, matching downstream %r.", existing.key) + + # Only synchronize comments for listings that op-in + if not issue.downstream.get('comments'): + return + log.info(" Looking for new comments") comments = client.comments(existing) comments_d = _comment_matching(issue.comments, comments)