Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
integrations: Remove label URL from GitHub issue labeled notifications.
Satyam Bansal8e63c0e42c8b
diff --git a/zerver/lib/webhooks/git.py b/zerver/lib/webhooks/git.pyindex 332d2a988b3..c1726849c00 100644--- a/zerver/lib/webhooks/git.py+++ b/zerver/lib/webhooks/git.py@@ -50,8 +50,10 @@ CREATE_BRANCH_MESSAGE_TEMPLATE = "{user_name} created [{branch_name}]({url}) braCREATE_BRANCH_WITHOUT_URL_MESSAGE_TEMPLATE = "{user_name} created {branch_name} branch."REMOVE_BRANCH_MESSAGE_TEMPLATE = "{user_name} deleted branch {branch_name}."-ISSUE_LABELED_OR_UNLABELED_MESSAGE_TEMPLATE = "[{user_name}]({user_url}) {action} the [{label_name}]({label_url}) label {preposition} [Issue #{id}]({url})."-ISSUE_LABELED_OR_UNLABELED_MESSAGE_TEMPLATE_WITH_TITLE = "[{user_name}]({user_url}) {action} the [{label_name}]({label_url}) label {preposition} [Issue #{id} {title}]({url})."+ISSUE_LABELED_OR_UNLABELED_MESSAGE_TEMPLATE = (+ "[{user_name}]({user_url}) {action} the {label_name} label {preposition} [Issue #{id}]({url})."+)+ISSUE_LABELED_OR_UNLABELED_MESSAGE_TEMPLATE_WITH_TITLE = "[{user_name}]({user_url}) {action} the {label_name} label {preposition} [Issue #{id} {title}]({url})."PULL_REQUEST_OR_ISSUE_MESSAGE_TEMPLATE = "{user_name} {action} [{type}{id}]({url})"PULL_REQUEST_OR_ISSUE_MESSAGE_TEMPLATE_WITH_TITLE = (@@ -282,7 +284,6 @@ def get_issue_labeled_or_unlabeled_event_message(url: str,number: int,label_name: str,- label_url: str,user_url: str,title: Optional[str] = None,) -> str:@@ -292,7 +293,6 @@ def get_issue_labeled_or_unlabeled_event_message("url": url,"id": number,"label_name": label_name,- "label_url": label_url,"user_url": user_url,"title": title,"preposition": "to" if action == "added" else "from",diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.pyindex 9a9467da18a..b00e265399d 100644--- a/zerver/webhooks/github/tests.py+++ b/zerver/webhooks/github/tests.py@@ -179,18 +179,18 @@ class GitHubWebhookTest(WebhookTestCase):def test_issue_labeled(self) -> None:expected_topic = "testing-gh / issue #9 idk man"- expected_message = "[sbansal1999](https://github.com/sbansal1999) added the [bug](https://api.github.com/repos/sbansal1999/testing-gh/labels/bug) label to [Issue #9](https://github.com/sbansal1999/testing-gh/issues/9)."+ expected_message = "[sbansal1999](https://github.com/sbansal1999) added the bug label to [Issue #9](https://github.com/sbansal1999/testing-gh/issues/9)."self.check_webhook("issues__labeled", expected_topic, expected_message)def test_issue_labeled_with_custom_topic_in_url(self) -> None:self.url = self.build_webhook_url(topic="notifications")expected_topic = "notifications"- expected_message = "[sbansal1999](https://github.com/sbansal1999) added the [bug](https://api.github.com/repos/sbansal1999/testing-gh/labels/bug) label to [Issue #9 idk man](https://github.com/sbansal1999/testing-gh/issues/9)."+ expected_message = "[sbansal1999](https://github.com/sbansal1999) added the bug label to [Issue #9 idk man](https://github.com/sbansal1999/testing-gh/issues/9)."self.check_webhook("issues__labeled", expected_topic, expected_message)def test_issue_unlabeled(self) -> None:expected_topic = "testing-gh / issue #9 idk man"- expected_message = "[sbansal1999](https://github.com/sbansal1999) removed the [bug](https://api.github.com/repos/sbansal1999/testing-gh/labels/bug) label from [Issue #9](https://github.com/sbansal1999/testing-gh/issues/9)."+ expected_message = "[sbansal1999](https://github.com/sbansal1999) removed the bug label from [Issue #9](https://github.com/sbansal1999/testing-gh/issues/9)."self.check_webhook("issues__unlabeled", expected_topic, expected_message)def test_membership_msg(self) -> None:diff --git a/zerver/webhooks/github/view.py b/zerver/webhooks/github/view.pyindex 9dab8dbb53f..d491d73f5c0 100644--- a/zerver/webhooks/github/view.py+++ b/zerver/webhooks/github/view.py@@ -216,7 +216,6 @@ def get_issue_labeled_or_unlabeled_body(helper: Helper) -> str:url=issue["html_url"].tame(check_string),number=issue["number"].tame(check_int),label_name=payload["label"]["name"].tame(check_string),- label_url=payload["label"]["url"].tame(check_string),user_url=get_sender_url(payload),title=issue["title"].tame(check_string) if include_title else None,)