Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
integrations/canarytoken: Use global time.
Niloth Pe4f7ba6f70a2
diff --git a/static/images/integrations/canarytoken/001.png b/static/images/integrations/canarytoken/001.pngindex 16dda94160c..9f5f294dbcd 100644Binary files a/static/images/integrations/canarytoken/001.png and b/static/images/integrations/canarytoken/001.png differdiff --git a/zerver/webhooks/canarytoken/tests.py b/zerver/webhooks/canarytoken/tests.pyindex 0d428bdd9cd..9bfe61dcc01 100644--- a/zerver/webhooks/canarytoken/tests.py+++ b/zerver/webhooks/canarytoken/tests.py@@ -8,7 +8,7 @@ class CanarytokensHookTests(WebhookTestCase):def test_canarytoken_new(self) -> None:expected_message = (- "**:alert: Canarytoken has been triggered on 2020-06-09 14:04:39!**\n\n"+ "**:alert: Canarytoken has been triggered on <time:2020-06-09 14:04:39Z>!**\n\n""Congrats! The newly saved webhook works \n\n""[Manage this canarytoken](http://example.com/test/url/for/webhook)")@@ -22,8 +22,7 @@ class CanarytokensHookTests(WebhookTestCase):def test_canarytoken_real(self) -> None:expected_message = (- "**:alert: Canarytoken has been triggered on 2020-06-09 14:04:47 "- "(UTC)!**\n\n"+ "**:alert: Canarytoken has been triggered on <time:2020-06-09 14:04:47Z>!**\n\n""Canarytoken example \n\n""[Manage this canarytoken]""(https://canarytokens.org/manage?token=foo&auth=bar)"@@ -39,8 +38,7 @@ class CanarytokensHookTests(WebhookTestCase):def test_canarytoken_with_specific_topic(self) -> None:self.url = self.build_webhook_url(topic="foo")expected_message = (- "**:alert: Canarytoken has been triggered on 2020-06-09 14:04:47 "- "(UTC)!**\n\n"+ "**:alert: Canarytoken has been triggered on <time:2020-06-09 14:04:47Z>!**\n\n""Canarytoken example \n\n""[Manage this canarytoken]""(https://canarytokens.org/manage?token=foo&auth=bar)"diff --git a/zerver/webhooks/canarytoken/view.py b/zerver/webhooks/canarytoken/view.pyindex 65e36e59f4b..d45985d9fc8 100644--- a/zerver/webhooks/canarytoken/view.py+++ b/zerver/webhooks/canarytoken/view.py@@ -28,8 +28,10 @@ def api_canarytoken_webhook(https://help.canary.tools/hc/en-gb/articles/360002426577-How-do-I-configure-notifications-for-a-Generic-Webhook-"""topic_name = "canarytoken alert"+ time = message["time"].tame(check_string)+ formatted_time = time.replace("(UTC)", "").strip() + "Z"body = (- f"**:alert: Canarytoken has been triggered on {message['time'].tame(check_string)}!**\n\n"+ f"**:alert: Canarytoken has been triggered on <time:{formatted_time}>!**\n\n"f"{message['memo'].tame(check_string)} \n\n"f"[Manage this canarytoken]({message['manage_url'].tame(check_string)})")