From d90cdc1f819f5809d069b3eb957def1c2d5d9b95 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 6 Mar 2018 13:51:50 +0000 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20change=20colour=20of=20sent=20d?= =?UTF-8?q?ate=20for=20letters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For text messages/emails it makes sense for ‘sending’ to be gray and ‘delivered’ to be black. But since we don’t show sending/delivered for letters it doesn’t make sense for the text to change colour. --- app/__init__.py | 35 +++++++++++++------ app/templates/components/table.html | 5 ++- .../partials/notifications/status.html | 2 +- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index c9d2242f6..cd58b8c3a 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -356,17 +356,32 @@ def format_notification_status_as_time(status, created, updated): }.get(status, updated) -def format_notification_status_as_field_status(status): +def format_notification_status_as_field_status(status, notification_type): return { - 'failed': 'error', - 'technical-failure': 'error', - 'temporary-failure': 'error', - 'permanent-failure': 'error', - 'delivered': None, - 'sent': None, - 'sending': 'default', - 'created': 'default' - }.get(status, 'error') + 'letter': { + 'failed': 'error', + 'technical-failure': 'error', + 'temporary-failure': 'error', + 'permanent-failure': 'error', + 'delivered': None, + 'sent': None, + 'sending': None, + 'created': None, + 'accepted': None, + } + }.get( + notification_type, + { + 'failed': 'error', + 'technical-failure': 'error', + 'temporary-failure': 'error', + 'permanent-failure': 'error', + 'delivered': None, + 'sent': None, + 'sending': 'default', + 'created': 'default' + } + ).get(status, 'error') def format_notification_status_as_url(status): diff --git a/app/templates/components/table.html b/app/templates/components/table.html index 380d595d0..49b554120 100644 --- a/app/templates/components/table.html +++ b/app/templates/components/table.html @@ -130,7 +130,10 @@ {% if not notification %} {% call field(align='right') %}{% endcall %} {% else %} - {% call field(status=notification.status|format_notification_status_as_field_status, align='right') %} + {% call field( + status=notification.status|format_notification_status_as_field_status(notification.notification_type), + align='right' + ) %} {% if notification.status in ['created', 'sending', 'delivered'] %}{% endif %} {% if notification.status|format_notification_status_as_url %} diff --git a/app/templates/partials/notifications/status.html b/app/templates/partials/notifications/status.html index 730eb6954..780445799 100644 --- a/app/templates/partials/notifications/status.html +++ b/app/templates/partials/notifications/status.html @@ -1,5 +1,5 @@