Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
integrations: Update comment related notifications in Jira integration.
PieterCK68c87dbdf8a7
diff --git a/zerver/webhooks/jira/tests.py b/zerver/webhooks/jira/tests.pyindex 24b3d1e87d0..9dbfa6e2e83 100644--- a/zerver/webhooks/jira/tests.py+++ b/zerver/webhooks/jira/tests.py@@ -219,24 +219,24 @@ Adding a comment. Oh, what a comment it is!def test_comment_event_comment_created(self) -> None:expected_topic_name = "SP-1: Add support for newer format Jira issue comment events"- expected_message = """Hemanth V. Alluri commented on issue: *"Add support for newer format Jira issue comment events"*\n``` quote\nSounds like it’s pretty important. I’ll get this fixed ASAP!\n```"""+ expected_message = """Hemanth V. Alluri commented on [SP-1: Add support for newer format Jira issue comment events](https://f20171170.atlassian.net/browse/SP-1)\n``` quote\nSounds like it’s pretty important. I’ll get this fixed ASAP!\n```"""self.check_webhook("comment_created", expected_topic_name, expected_message)def test_comment_event_comment_created_no_issue_details(self) -> None:expected_topic_name = "10000: Upgrade Jira to get the issue title here."- expected_message = """Hemanth V. Alluri commented on issue: *"Upgrade Jira to get the issue title here."*\n``` quote\nSounds like it’s pretty important. I’ll get this fixed ASAP!\n```"""+ expected_message = """Hemanth V. Alluri commented on 10000: Upgrade Jira to get the issue title here.\n``` quote\nSounds like it’s pretty important. I’ll get this fixed ASAP!\n```"""self.check_webhook("comment_created_no_issue_details", expected_topic_name, expected_message)def test_comment_event_comment_edited(self) -> None:expected_topic_name = "SP-1: Add support for newer format Jira issue comment events"- expected_message = """Hemanth V. Alluri updated their comment on issue: *"Add support for newer format Jira issue comment events"*\n``` quote\nThis is a very important issue! I’m on it!\n```"""+ expected_message = """Hemanth V. Alluri updated their comment on [SP-1: Add support for newer format Jira issue comment events](https://f20171170.atlassian.net/browse/SP-1)\n``` quote\nThis is a very important issue! I’m on it!\n```"""self.check_webhook("comment_updated", expected_topic_name, expected_message)def test_comment_event_comment_deleted(self) -> None:expected_topic_name = "SP-1: Add support for newer format Jira issue comment events"- expected_message = """Hemanth V. Alluri deleted their comment on issue: *"Add support for newer format Jira issue comment events"*\n``` quote\n~~This is a very important issue! I’m on it!~~\n```"""+ expected_message = """Hemanth V. Alluri deleted their comment on [SP-1: Add support for newer format Jira issue comment events](https://f20171170.atlassian.net/browse/SP-1)\n``` quote\n~~This is a very important issue! I’m on it!~~\n```"""self.check_webhook("comment_deleted", expected_topic_name, expected_message)def test_anomalous_webhook_payload_error(self) -> None:diff --git a/zerver/webhooks/jira/view.py b/zerver/webhooks/jira/view.pyindex 3bfdde2bf06..22994c0fd39 100644--- a/zerver/webhooks/jira/view.py+++ b/zerver/webhooks/jira/view.py@@ -310,31 +310,28 @@ def normalize_comment(comment: str) -> str:def handle_comment_created_event(payload: WildValue, user_profile: UserProfile) -> str:- title = get_issue_title(payload)- return '{author} commented on issue: *"{title}"\-*\n``` quote\n{comment}\n```\n'.format(+ return "{author} commented on {issue_string}\+\n``` quote\n{comment}\n```\n".format(author=payload["comment"]["author"]["displayName"].tame(check_string),- title=title,+ issue_string=get_issue_string(payload, with_title=True),comment=normalize_comment(payload["comment"]["body"].tame(check_string)),)def handle_comment_updated_event(payload: WildValue, user_profile: UserProfile) -> str:- title = get_issue_title(payload)- return '{author} updated their comment on issue: *"{title}"\-*\n``` quote\n{comment}\n```\n'.format(+ return "{author} updated their comment on {issue_string}\+\n``` quote\n{comment}\n```\n".format(author=payload["comment"]["author"]["displayName"].tame(check_string),- title=title,+ issue_string=get_issue_string(payload, with_title=True),comment=normalize_comment(payload["comment"]["body"].tame(check_string)),)def handle_comment_deleted_event(payload: WildValue, user_profile: UserProfile) -> str:- title = get_issue_title(payload)- return '{author} deleted their comment on issue: *"{title}"\-*\n``` quote\n~~{comment}~~\n```\n'.format(+ return "{author} deleted their comment on {issue_string}\+\n``` quote\n~~{comment}~~\n```\n".format(author=payload["comment"]["author"]["displayName"].tame(check_string),- title=title,+ issue_string=get_issue_string(payload, with_title=True),comment=normalize_comment(payload["comment"]["body"].tame(check_string)),)