Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhooks: Change assignee info for Issue events in Github Integration.
sbansal199931a9d0e69ef7
diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.pyindex ca6b9e6d63a..2be5beea4db 100644--- a/zerver/webhooks/github/tests.py+++ b/zerver/webhooks/github/tests.py@@ -154,14 +154,14 @@ class GitHubWebhookTest(WebhookTestCase):self.check_webhook("issues__assigned", expected_topic, expected_message)def test_issue_unassigned(self) -> None:- expected_message = "sbansal1999 unassigned [issue #9](https://github.com/sbansal1999/testing-gh/issues/9) (assigned to tester987654)."+ expected_message = "sbansal1999 unassigned [issue #9](https://github.com/sbansal1999/testing-gh/issues/9) (assigned to sbansal1999)."expected_topic = "testing-gh / issue #9 idk man"self.check_webhook("issues__unassigned", expected_topic, expected_message)def test_issue_unassigned_with_custom_topic_in_url(self) -> None:self.url = self.build_webhook_url(topic="notifications")expected_topic = "notifications"- expected_message = "sbansal1999 unassigned [issue #9 idk man](https://github.com/sbansal1999/testing-gh/issues/9) (assigned to tester987654)."+ expected_message = "sbansal1999 unassigned [issue #9 idk man](https://github.com/sbansal1999/testing-gh/issues/9) (assigned to sbansal1999)."self.check_webhook("issues__unassigned", expected_topic, expected_message)def test_membership_msg(self) -> None:diff --git a/zerver/webhooks/github/view.py b/zerver/webhooks/github/view.pyindex 03601f559ee..48ef43939c5 100644--- a/zerver/webhooks/github/view.py+++ b/zerver/webhooks/github/view.py@@ -159,7 +159,7 @@ def get_issue_body(helper: Helper) -> str:include_title = helper.include_titleaction = payload["action"].tame(check_string)issue = payload["issue"]- assignee = issue["assignee"]+ has_assignee = "assignee" in payloadreturn get_issue_event_message(user_name=get_sender_name(payload),action=action,@@ -168,7 +168,7 @@ def get_issue_body(helper: Helper) -> str:message=Noneif action in ("assigned", "unassigned")else issue["body"].tame(check_none_or(check_string)),- assignee=assignee["login"].tame(check_string) if assignee else None,+ assignee=payload["assignee"]["login"].tame(check_string) if has_assignee else None,title=issue["title"].tame(check_string) if include_title else None,)