From f47a1c67a627e354cbddddb5b28d141a341f4764 Mon Sep 17 00:00:00 2001 From: sbansal1999 Date: Tue, 4 Apr 2023 07:52:00 +0530 Subject: [PATCH] webhooks: Add body to PR Review Event message for GitHub Integration. This commit passes the body of the PR Review as the message to the helper function that generates the message to be sent by the GitHub Integration. Previously when a PR Review was done the message sent would just include the link of the review but the message didn't include the body the review. After this commit, the message also includes the body of the review. Fixes #24676 --- zerver/webhooks/github/tests.py | 4 ++-- zerver/webhooks/github/view.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.py index 72a4a02249..146c865b18 100644 --- a/zerver/webhooks/github/tests.py +++ b/zerver/webhooks/github/tests.py @@ -240,13 +240,13 @@ class GitHubWebhookTest(WebhookTestCase): self.check_webhook("status__with_target_url", TOPIC_REPO, expected_message) def test_pull_request_review_msg(self) -> None: - expected_message = "baxterthehacker submitted [PR review](https://github.com/baxterthehacker/public-repo/pull/1#pullrequestreview-2626884)." + expected_message = "baxterthehacker submitted [PR review](https://github.com/baxterthehacker/public-repo/pull/1#pullrequestreview-2626884):\n\n~~~ quote\nLooks great!\n~~~" self.check_webhook("pull_request_review", TOPIC_PR, expected_message) def test_pull_request_review_msg_with_custom_topic_in_url(self) -> None: self.url = self.build_webhook_url(topic="notifications") expected_topic = "notifications" - expected_message = "baxterthehacker submitted [PR review for #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1#pullrequestreview-2626884)." + expected_message = "baxterthehacker submitted [PR review for #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1#pullrequestreview-2626884):\n\n~~~ quote\nLooks great!\n~~~" self.check_webhook("pull_request_review", expected_topic, expected_message) def test_pull_request_review_comment_msg(self) -> None: diff --git a/zerver/webhooks/github/view.py b/zerver/webhooks/github/view.py index ea22a580ea..8b414adcac 100644 --- a/zerver/webhooks/github/view.py +++ b/zerver/webhooks/github/view.py @@ -490,6 +490,7 @@ def get_pull_request_review_body(helper: Helper) -> str: url=payload["review"]["html_url"].tame(check_string), type="PR review", title=title if include_title else None, + message=payload["review"]["body"].tame(check_string), )