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 issue assigned message body.

Lauryn Menardf6e17fa972db
diff --git a/zerver/webhooks/github/fixtures/issues__assigned.json b/zerver/webhooks/github/fixtures/issues__assigned.json
index c4f7349da5d..89af7907f2c 100644
--- a/zerver/webhooks/github/fixtures/issues__assigned.json
+++ b/zerver/webhooks/github/fixtures/issues__assigned.json
@@ -10,7 +10,7 @@
"id": 1651035101,
"node_id": "I_kwDOJRp_V85iaMvd",
"number": 7,
- "title": "Sample Issue testing something",
+ "title": "Testing when issue assigned!",
"user": {
"login": "sbansal1999",
"id": 35286603,
diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.py
index c4364836c2d..83df42c6c35 100644
--- a/zerver/webhooks/github/tests.py
+++ b/zerver/webhooks/github/tests.py
@@ -160,14 +160,14 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("issues", expected_topic, expected_message)
def test_issue_assigned(self) -> None:
- expected_message = "sbansal1999 assigned [issue #7](https://github.com/sbansal1999/testing-gh/issues/7) to sbansal1999."
- expected_topic = "testing-gh / issue #7 Sample Issue testing something"
+ expected_message = "sbansal1999 assigned sbansal1999 to [issue #7](https://github.com/sbansal1999/testing-gh/issues/7)."
+ expected_topic = "testing-gh / issue #7 Testing when issue assigned!"
self.check_webhook("issues__assigned", expected_topic, expected_message)
def test_issue_assigned_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
- expected_message = "sbansal1999 assigned [issue #7 Sample Issue testing something](https://github.com/sbansal1999/testing-gh/issues/7) to sbansal1999."
+ expected_message = "sbansal1999 assigned sbansal1999 to [issue #7 Testing when issue assigned!](https://github.com/sbansal1999/testing-gh/issues/7)"
self.check_webhook("issues__assigned", expected_topic, expected_message)
def test_issue_unassigned(self) -> None:
diff --git a/zerver/webhooks/github/view.py b/zerver/webhooks/github/view.py
index 90dd54b4d2a..b144f840afe 100644
--- a/zerver/webhooks/github/view.py
+++ b/zerver/webhooks/github/view.py
@@ -170,9 +170,9 @@ def get_issue_body(helper: Helper) -> str:
if has_assignee:
stringified_assignee = payload["assignee"]["login"].tame(check_string)
if action == "assigned":
- return f"{base_message[:-1]} to {stringified_assignee}."
+ return base_message.replace("assigned", f"assigned {stringified_assignee} to", 1)
elif action == "unassigned":
- return base_message.replace("unassigned", f"unassigned {stringified_assignee} from")
+ return base_message.replace("unassigned", f"unassigned {stringified_assignee} from", 1)
return base_message