Skip to content
Snippets Groups Projects
Unverified Commit a7e1d254 authored by Noah Moss's avatar Noah Moss Committed by GitHub
Browse files

Use UTC as default timezone in alert template when report timezone isn't set (#18257)

parent 78f4ab6b
Branches
Tags
No related merge requests found
......@@ -535,6 +535,10 @@
"sat" "Saturday"}
day))
(defn- schedule-timezone
[]
(or (driver/report-timezone) "UTC"))
(defn- alert-schedule-text
"Returns a string that describes the run schedule of an alert (i.e. how often results are checked),
for inclusion in the email template. Not translated, since emails in general are not currently translated."
......@@ -546,13 +550,13 @@
:daily
(format "Run daily at %s %s"
(schedule-hour-text channel)
(driver/report-timezone))
(schedule-timezone))
:weekly
(format "Run weekly on %s at %s %s"
(schedule-day-text channel)
(schedule-hour-text channel)
(driver/report-timezone))))
(schedule-timezone))))
(defn- alert-context
"Context that is applicable only to the actual alert template (not alert management templates)"
......
......@@ -74,4 +74,9 @@
(is (= "Run weekly on Monday at 8 AM America/Pacific"
(@#'messages/alert-schedule-text {:schedule_type :weekly
:schedule_day "mon"
:schedule_hour 8}))))))
:schedule_hour 8})))))
(testing "If report-timezone is not set, falls back to UTC"
(tu/with-temporary-setting-values [report-timezone nil]
(is (= "Run daily at 12 AM UTC"
(@#'messages/alert-schedule-text {:schedule_type :daily
:schedule_hour 0}))))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment