Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

integrations: Reformat Github pull request assigned message body.

Lauryn Menarda4d1211ec692
diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.py
index 83df42c6c35..4547ac23aad 100644
--- a/zerver/webhooks/github/tests.py
+++ b/zerver/webhooks/github/tests.py
@@ -375,13 +375,13 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("pull_request__synchronized_with_body", TOPIC_PR, expected_message)
def test_pull_request_assigned_msg(self) -> None:
- expected_message = "baxterthehacker assigned [PR #1](https://github.com/baxterthehacker/public-repo/pull/1) to baxterthehacker."
+ expected_message = "baxterthehacker assigned baxterthehacker to [PR #1](https://github.com/baxterthehacker/public-repo/pull/1)."
self.check_webhook("pull_request__assigned", TOPIC_PR, expected_message)
def test_pull_request_assigned_msg_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
- expected_message = "baxterthehacker assigned [PR #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1) to baxterthehacker."
+ expected_message = "baxterthehacker assigned baxterthehacker to [PR #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1)."
self.check_webhook("pull_request__assigned", expected_topic, expected_message)
def test_pull_request_unassigned_msg(self) -> None:
diff --git a/zerver/webhooks/github/view.py b/zerver/webhooks/github/view.py
index b144f840afe..fdd1d3e0632 100644
--- a/zerver/webhooks/github/view.py
+++ b/zerver/webhooks/github/view.py
@@ -104,7 +104,7 @@ def get_assigned_or_unassigned_pull_request_body(helper: Helper) -> str:
title=pull_request["title"].tame(check_string) if include_title else None,
)
if assignee:
- return f"{base_message[:-1]} to {stringified_assignee}."
+ return base_message.replace("assigned", f"assigned {stringified_assignee} to", 1)
return base_message