mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-16 11:20:12 -04:00
Make permanent failure status more human
Replace with ‘Phone number doesn’t exist’ or ‘Email address doesn’t’ exist.
This commit is contained in:
@@ -229,15 +229,25 @@ def valid_phone_number(phone_number):
|
||||
return False
|
||||
|
||||
|
||||
def format_notification_status(status):
|
||||
m = {'failed': 'Failed',
|
||||
'technical-failure': 'Technical failure',
|
||||
'temporary-failure': 'Temporarily failed',
|
||||
'permanent-failure': 'Permanently failed',
|
||||
'delivered': 'Delivered',
|
||||
'sending': 'Sending'
|
||||
}
|
||||
return m.get(status, status)
|
||||
def format_notification_status(status, template_type):
|
||||
return {
|
||||
'email': {
|
||||
'failed': 'Failed',
|
||||
'technical-failure': 'Technical failure',
|
||||
'temporary-failure': 'Temporary failure',
|
||||
'permanent-failure': 'Email address does not exist',
|
||||
'delivered': 'Delivered',
|
||||
'sending': 'Sending'
|
||||
},
|
||||
'sms': {
|
||||
'failed': 'Failed',
|
||||
'technical-failure': 'Technical failure',
|
||||
'temporary-failure': 'Temporary failure',
|
||||
'permanent-failure': 'Phone number does not exist',
|
||||
'delivered': 'Delivered',
|
||||
'sending': 'Sending'
|
||||
}
|
||||
}.get(template_type).get(status, status)
|
||||
|
||||
|
||||
@login_manager.user_loader
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
caption="Recent activity",
|
||||
caption_visible=False,
|
||||
empty_message='No messages found',
|
||||
field_headings=['Recipient', 'Status', 'Started'],
|
||||
field_headings=['Recipient', 'Error', 'Status', 'Started'],
|
||||
field_headings_visible=False
|
||||
) %}
|
||||
|
||||
@@ -56,19 +56,22 @@
|
||||
</p>
|
||||
<p class="hint">
|
||||
{% if item.job %}
|
||||
From <a href="{{ url_for(".view_job", service_id=current_service.id, job_id=item.job.id) }}">{{ item.job.original_file_name }}</a>
|
||||
From <a class="truncated" href="{{ url_for(".view_job", service_id=current_service.id, job_id=item.job.id) }}">{{ item.job.original_file_name }}</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('.view_template_version', service_id=current_service.id, template_id=item.template.id, version=item.template_version) }}">{{ item.template.name }}</a>
|
||||
<a class="truncated" href="{{ url_for('.view_template_version', service_id=current_service.id, template_id=item.template.id, version=item.template_version) }}">{{ item.template.name }}</a>
|
||||
from an API call
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endcall %}
|
||||
|
||||
{{ text_field(item.status|format_notification_status) }}
|
||||
{{ date_field(
|
||||
(item.updated_at or item.created_at)|format_datetime_short
|
||||
) }}
|
||||
|
||||
{% call field(align='right') %}
|
||||
{{ (item.updated_at or item.created_at)|format_datetime_short }}
|
||||
{% call field(status='', align='right') %}
|
||||
{{ item.status|format_notification_status(item.template.template_type) }}
|
||||
{% endcall %}
|
||||
|
||||
{% endcall %}
|
||||
|
||||
{{ previous_next_navigation(prev_page, next_page) }}
|
||||
|
||||
Reference in New Issue
Block a user