mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-23 09:29:14 -04:00
Don’t show status for individual letters
The status won’t ever change from sending for letters. For now at least. And even when we do come up with more useful statuses I’m not convinced it’s useful to expose them to our admin users. A more useful piece of information to show is when we think the letter will be delivered.
This commit is contained in:
@@ -19,6 +19,7 @@ from app.utils import (
|
||||
get_help_argument,
|
||||
get_template,
|
||||
get_time_left,
|
||||
get_letter_timings,
|
||||
REQUESTED_STATUSES,
|
||||
FAILURE_STATUSES,
|
||||
SENDING_STATUSES,
|
||||
@@ -63,6 +64,7 @@ def view_notification(service_id, notification_id):
|
||||
job = job_api_client.get_job(service_id, notification['job']['id'])['data']
|
||||
else:
|
||||
job = None
|
||||
|
||||
return render_template(
|
||||
'views/notifications/notification.html',
|
||||
finished=(notification['status'] in (DELIVERED_STATUSES + FAILURE_STATUSES)),
|
||||
@@ -79,7 +81,8 @@ def view_notification(service_id, notification_id):
|
||||
partials=get_single_notification_partials(notification),
|
||||
created_by=notification.get('created_by'),
|
||||
created_at=notification['created_at'],
|
||||
help=get_help_argument()
|
||||
help=get_help_argument(),
|
||||
estimated_letter_delivery_date=get_letter_timings(notification['created_at']).earliest_delivery,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -30,8 +30,16 @@
|
||||
on {{ created_at|format_datetime_short }}
|
||||
</p>
|
||||
|
||||
{% if template.template_type == 'letter' %}
|
||||
<p>
|
||||
Estimated delivery date: {{ estimated_letter_delivery_date|string|format_date_short }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{{ template|string }}
|
||||
|
||||
{{ ajax_block(partials, updates_url, 'status', finished=finished) }}
|
||||
{% if template.template_type != 'letter' %}
|
||||
{{ ajax_block(partials, updates_url, 'status', finished=finished) }}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -86,7 +86,7 @@ def service_json(
|
||||
def template_json(service_id,
|
||||
id_,
|
||||
name="sample template",
|
||||
type_="sms",
|
||||
type_=None,
|
||||
content=None,
|
||||
subject=None,
|
||||
version=1,
|
||||
@@ -97,7 +97,7 @@ def template_json(service_id,
|
||||
template = {
|
||||
'id': id_,
|
||||
'name': name,
|
||||
'template_type': type_,
|
||||
'template_type': type_ or "sms",
|
||||
'content': content,
|
||||
'service': service_id,
|
||||
'version': version,
|
||||
@@ -226,9 +226,10 @@ def notification_json(
|
||||
with_links=False,
|
||||
rows=5,
|
||||
personalisation=None,
|
||||
template_type=None,
|
||||
):
|
||||
if template is None:
|
||||
template = template_json(service_id, str(generate_uuid()))
|
||||
template = template_json(service_id, str(generate_uuid()), type_=template_type)
|
||||
if sent_at is None:
|
||||
sent_at = str(datetime.utcnow().time())
|
||||
if created_at is None:
|
||||
|
||||
@@ -110,3 +110,27 @@ def test_notification_page_doesnt_link_to_template_in_tour(
|
||||
'sample template sent by Test User on 1 January at 1:01am'
|
||||
)
|
||||
assert len(page.select('main p:nth-of-type(1) a')) == 0
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 01:01")
|
||||
def test_notification_page_shows_status_of_letter_notification(
|
||||
client_request,
|
||||
mocker,
|
||||
fake_uuid,
|
||||
):
|
||||
|
||||
mock_get_notification(mocker, fake_uuid, template_type='letter')
|
||||
|
||||
page = client_request.get(
|
||||
'main.view_notification',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
notification_id=fake_uuid,
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select('main p:nth-of-type(1)')[0].text) == (
|
||||
'sample template sent by Test User on 1 January at 1:01am'
|
||||
)
|
||||
assert normalize_spaces(page.select('main p:nth-of-type(2)')[0].text) == (
|
||||
'Estimated delivery date: 6 January'
|
||||
)
|
||||
assert page.select('p.notification-status') == []
|
||||
|
||||
@@ -1679,6 +1679,7 @@ def mock_get_notification(
|
||||
fake_uuid,
|
||||
notification_status='delivered',
|
||||
redact_personalisation=False,
|
||||
template_type=None,
|
||||
):
|
||||
def _get_notification(
|
||||
service_id,
|
||||
@@ -1687,7 +1688,8 @@ def mock_get_notification(
|
||||
noti = notification_json(
|
||||
service_id,
|
||||
rows=1,
|
||||
status=notification_status
|
||||
status=notification_status,
|
||||
template_type=template_type,
|
||||
)['notifications'][0]
|
||||
|
||||
noti['id'] = notification_id
|
||||
@@ -1702,6 +1704,7 @@ def mock_get_notification(
|
||||
'5407f4db-51c7-4150-8758-35412d42186a',
|
||||
content='hello ((name))',
|
||||
redact_personalisation=redact_personalisation,
|
||||
type_=template_type,
|
||||
)
|
||||
return noti
|
||||
|
||||
|
||||
Reference in New Issue
Block a user