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.

webhooks/papertrail: Use the datetime value with the timezone info.

Niloth P9a023709e928
diff --git a/zerver/webhooks/papertrail/tests.py b/zerver/webhooks/papertrail/tests.py
index ed9a1cb1107..c5933f186b3 100644
--- a/zerver/webhooks/papertrail/tests.py
+++ b/zerver/webhooks/papertrail/tests.py
@@ -15,11 +15,11 @@ class PapertrailHookTests(WebhookTestCase):
expected_message = """
[Search for "Important stuff"](https://papertrailapp.com/searches/42) found **2** matches:
-<time:May 18 20:30:02> - abc - cron OR server1:
+<time:2011-05-18T20:30:02-07:00> - abc - cron OR server1:
``` quote
message body
```
-<time:May 18 20:30:02> - server1 - cron OR server1:
+<time:2011-05-18T20:30:02-07:00> - server1 - cron OR server1:
``` quote
A short event
```
@@ -37,19 +37,19 @@ A short event
expected_message = """
[Search for "Important stuff"](https://papertrailapp.com/searches/42) found **5** matches:
-<time:May 18 20:30:02> - abc - cron OR server1:
+<time:2011-05-18T20:30:02-07:00> - abc - cron OR server1:
``` quote
message body 1
```
-<time:May 18 20:30:02> - abc - cron OR server1:
+<time:2011-05-18T20:30:02-07:00> - abc - cron OR server1:
``` quote
message body 2
```
-<time:May 18 20:30:02> - abc - cron OR server1:
+<time:2011-05-18T20:30:02-07:00> - abc - cron OR server1:
``` quote
message body 3
```
-<time:May 18 20:30:02> - abc - cron OR server1:
+<time:2011-05-18T20:30:02-07:00> - abc - cron OR server1:
``` quote
message body 4
```
diff --git a/zerver/webhooks/papertrail/view.py b/zerver/webhooks/papertrail/view.py
index efe5747df67..a07ab4c121a 100644
--- a/zerver/webhooks/papertrail/view.py
+++ b/zerver/webhooks/papertrail/view.py
@@ -39,7 +39,7 @@ def api_papertrail_webhook(
for i, event in enumerate(payload["events"]):
event_text = SEARCH_TEMPLATE.format(
- timestamp=event["display_received_at"].tame(check_string),
+ timestamp=event["received_at"].tame(check_string),
source=event["source_name"].tame(check_string),
query=payload["saved_search"]["query"].tame(check_string),
message=event["message"].tame(check_string),