From cda7ed71012a4a0f99777191cb92ac3aeb48e6b8 Mon Sep 17 00:00:00 2001 From: Satyam Bansal Date: Wed, 12 Jul 2023 02:17:36 +0530 Subject: [PATCH] integrations: Use correct type for GitHub pull request comment messages. --- zerver/webhooks/github/tests.py | 2 +- zerver/webhooks/github/view.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.py index 9a20141367bed..c4364836c2da3 100644 --- a/zerver/webhooks/github/tests.py +++ b/zerver/webhooks/github/tests.py @@ -146,7 +146,7 @@ def test_issue_comment_msg_with_custom_topic_in_url(self) -> None: self.check_webhook("issue_comment", expected_topic, expected_message) def test_issue_comment_pull_request_comment_msg(self) -> None: - expected_message = "sbansal1999 [commented](https://github.com/sbansal1999/public-repo/pull/1#issuecomment-1631445420) on [issue #1](https://github.com/sbansal1999/public-repo/pull/1):\n\n~~~ quote\nSome comment\n~~~" + expected_message = "sbansal1999 [commented](https://github.com/sbansal1999/public-repo/pull/1#issuecomment-1631445420) on [PR #1](https://github.com/sbansal1999/public-repo/pull/1):\n\n~~~ quote\nSome comment\n~~~" self.check_webhook("issue_comment__pull_request_comment", TOPIC_PR, expected_message) def test_issue_msg(self) -> None: diff --git a/zerver/webhooks/github/view.py b/zerver/webhooks/github/view.py index b7d37af026d3c..90dd54b4d2a90 100644 --- a/zerver/webhooks/github/view.py +++ b/zerver/webhooks/github/view.py @@ -190,13 +190,14 @@ def get_issue_comment_body(helper: Helper) -> str: action = f"{action} a [comment]" action += "({}) on".format(comment["html_url"].tame(check_string)) - return get_issue_event_message( + return get_pull_request_event_message( user_name=get_sender_name(payload), action=action, url=issue["html_url"].tame(check_string), number=issue["number"].tame(check_int), message=comment["body"].tame(check_string), title=issue["title"].tame(check_string) if include_title else None, + type="PR" if is_pull_request_comment_event(payload) else "issue", )