From 5b5ad2c5dc154696460d96ef12f07d295b1e01be Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 6 Jun 2016 13:30:39 +0100 Subject: [PATCH] Fix 500 on job page when notifications are sending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sending notifications don’t have an `updated_at`. This causes the time formatting to throw a wobly, because it doesn’t expect `None`. This commit changes the template to also look for the `created_at`, which all notifications have. --- app/templates/partials/jobs/notifications.html | 2 +- app/templates/views/notifications.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/partials/jobs/notifications.html b/app/templates/partials/jobs/notifications.html index 0bbdd2b46..2dd4ecdc8 100644 --- a/app/templates/partials/jobs/notifications.html +++ b/app/templates/partials/jobs/notifications.html @@ -28,7 +28,7 @@ align='right', status='error' if item.status == 'Failed' else 'default' ) %} - {{ item.status|format_notification_status }} at {{ item.updated_at|format_time }} + {{ item.status|format_notification_status }} at {{ (item.updated_at or item.created_at)|format_time }} {% endcall %} {% endcall %} {% else %} diff --git a/app/templates/views/notifications.html b/app/templates/views/notifications.html index 6b7d30d29..e811692f2 100644 --- a/app/templates/views/notifications.html +++ b/app/templates/views/notifications.html @@ -94,7 +94,7 @@ {{ text_field(item.status|format_notification_status) }} {% call field(align='right') %} - {{ item.updated_at|format_datetime_short }} + {{ (item.updated_at or item.created_at)|format_datetime_short }} {% endcall %} {% endcall %}