mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-06 10:31:03 -04:00
created an alert for confirmation during send flow
This commit is contained in:
@@ -53,6 +53,7 @@ from app.formatters import (
|
||||
format_datetime_normal,
|
||||
format_datetime_relative,
|
||||
format_datetime_short,
|
||||
format_datetime_short_12h,
|
||||
format_datetime_short_america,
|
||||
format_day_of_week,
|
||||
format_delta,
|
||||
@@ -549,6 +550,7 @@ def add_template_filters(application):
|
||||
format_datetime_24h,
|
||||
format_datetime_normal,
|
||||
format_datetime_short,
|
||||
format_datetime_short_12h,
|
||||
format_datetime_short_america,
|
||||
valid_phone_number,
|
||||
linkable_name,
|
||||
|
||||
@@ -98,6 +98,12 @@ def format_datetime_short(date):
|
||||
)
|
||||
|
||||
|
||||
def format_datetime_short_12h(date):
|
||||
return "{} at {} {}".format(
|
||||
format_date_short(date), format_time_12h(date), get_user_preferred_timezone()
|
||||
)
|
||||
|
||||
|
||||
def format_datetime_short_america(date):
|
||||
return "{} at {}".format(format_date_numeric_america(date), format_time_12h(date))
|
||||
|
||||
|
||||
@@ -2,12 +2,33 @@
|
||||
<p class='bottom-gutter'>
|
||||
{% if job.scheduled_for %}
|
||||
{% if job.processing_started %}
|
||||
Sent by {{ job.created_by.name }} on {{ job.processing_started|format_datetime_short }}
|
||||
<div class="usa-alert usa-alert--success">
|
||||
<div class="usa-alert__body">
|
||||
<h4 class="usa-alert__heading">{{ job.template_name }} - {{ current_service.name }}</h4>
|
||||
<p class="usa-alert__text">
|
||||
Was sent on {{ job.created_at|format_datetime_short_12h }} by {{ job.created_by.name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
|
||||
<div class="usa-alert usa-alert--info">
|
||||
<div class="usa-alert__body">
|
||||
<h4 class="usa-alert__heading">{{ job.template_name }} - {{ current_service.name }}</h4>
|
||||
<p class="usa-alert__text">
|
||||
Was scheduled on {{ job.scheduled_for|format_datetime_short_12h }} by {{ job.created_by.name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
Sent by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
|
||||
<div class="usa-alert usa-alert--success">
|
||||
<div class="usa-alert__body">
|
||||
<h4 class="usa-alert__heading">{{ job.template_name }} - {{ current_service.name }}</h4>
|
||||
<p class="usa-alert__text">
|
||||
Was sent on {{ job.created_at|format_datetime_short_12h }} by {{ job.created_by.name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% if job.status == 'sending limits exceeded'%}
|
||||
|
||||
@@ -24,18 +24,16 @@
|
||||
{% if help %}
|
||||
‘{{ template.name }}’
|
||||
{% else %}
|
||||
<a class="usa-link" href="{{ url_for('.view_template', service_id=current_service.id, template_id=template.id) }}">‘{{ template.name }}’</a>
|
||||
<!-- <a class="usa-link" href="{{ url_for('.view_template', service_id=current_service.id, template_id=template.id) }}">‘{{ template.name }}’</a> -->
|
||||
{% endif %}
|
||||
was sent
|
||||
{% if job and job.original_file_name != 'Report' %}
|
||||
{% set destination =
|
||||
{'email': 'an email address', 'sms': 'a phone number'} %}
|
||||
to {{ destination[template.template_type] }} from
|
||||
<a class="usa-link" href="{{ url_for('.view_job', service_id=current_service.id, job_id=job.id) }}">{{ job.original_file_name }}</a>
|
||||
{% elif created_by %}
|
||||
by {{ created_by.name }}
|
||||
{% endif %}
|
||||
{{ created_at|format_datetime_human }}
|
||||
<div class="usa-alert usa-alert--success">
|
||||
<div class="usa-alert__body">
|
||||
<h4 class="usa-alert__heading">{{ template.name }} - {{ current_service.name }}</h4>
|
||||
<p class="usa-alert__text">
|
||||
Was sent on {{ created_at|format_datetime_short_12h }} by {{ created_by.name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
|
||||
<div class="">
|
||||
|
||||
@@ -237,11 +237,11 @@ def test_should_show_job_with_sending_limit_exceeded_status(
|
||||
job_id=fake_uuid,
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select("main p")[1].text) == (
|
||||
assert normalize_spaces(page.select("main p")[2].text) == (
|
||||
"Notify cannot send these messages because you have reached a limit. "
|
||||
"You can only send 1,000 messages per day and 250,000 messages in total."
|
||||
)
|
||||
assert normalize_spaces(page.select("main p")[2].text) == (
|
||||
assert normalize_spaces(page.select("main p")[3].text) == (
|
||||
"Upload this spreadsheet again tomorrow or contact the Notify.gov team to raise the limit."
|
||||
)
|
||||
|
||||
@@ -350,7 +350,7 @@ def test_should_show_scheduled_job(
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select("main div p")[1].text) == (
|
||||
"Sending Two week reminder today at 00:00 US/Eastern"
|
||||
"Was scheduled on 2 January at 12:00 AM US/Eastern by Test User"
|
||||
)
|
||||
|
||||
assert page.select("main p a")[0]["href"] == url_for(
|
||||
@@ -425,7 +425,9 @@ def test_should_show_updates_for_one_job_as_json(
|
||||
assert "Status" in content["notifications"]
|
||||
assert "Delivered" in content["notifications"]
|
||||
assert "00:00" in content["notifications"]
|
||||
assert "Sent by Test User on 1 January at 00:00" in content["status"]
|
||||
assert (
|
||||
"Was sent on 1 January at 12:00 AM US/Eastern by Test User" in content["status"]
|
||||
)
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 05:00:00.000001")
|
||||
@@ -467,7 +469,9 @@ def test_should_show_updates_for_scheduled_job_as_json(
|
||||
assert "Status" in content["notifications"]
|
||||
assert "Delivered" in content["notifications"]
|
||||
assert "00:00" in content["notifications"]
|
||||
assert "Sent by Test User on 1 June at 16:00" in content["status"]
|
||||
assert (
|
||||
"Was sent on 1 January at 12:00 AM US/Eastern by Test User" in content["status"]
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -226,22 +226,30 @@ def test_notification_status_shows_expected_back_link(
|
||||
[
|
||||
(
|
||||
"2012-01-01 06:01",
|
||||
("‘sample template’ was sent by Test User today at 01:01 US/Eastern"),
|
||||
(
|
||||
"‘sample template’ sample template - service one Was sent on 1 January at 01:01 AM US/Eastern "
|
||||
"by Test User"
|
||||
),
|
||||
),
|
||||
(
|
||||
"2012-01-02 06:01",
|
||||
("‘sample template’ was sent by Test User yesterday at 01:01 US/Eastern"),
|
||||
(
|
||||
"‘sample template’ sample template - service one Was sent on 1 January at 01:01 AM US/Eastern "
|
||||
"by Test User"
|
||||
),
|
||||
),
|
||||
(
|
||||
"2012-01-03 06:01",
|
||||
(
|
||||
"‘sample template’ was sent by Test User on 1 January at 01:01 US/Eastern"
|
||||
"‘sample template’ sample template - service one Was sent on 1 January at 01:01 AM US/Eastern "
|
||||
"by Test User"
|
||||
),
|
||||
),
|
||||
(
|
||||
"2013-01-03 06:01",
|
||||
(
|
||||
"‘sample template’ was sent by Test User on 1 January 2012 at 01:01 US/Eastern"
|
||||
"‘sample template’ sample template - service one Was sent on 1 January at 01:01 AM US/Eastern "
|
||||
"by Test User"
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user