mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 18:37:33 -04:00
fix date format in batch review (notify-admin-1171)
This commit is contained in:
+10
-6
@@ -1781,12 +1781,16 @@ class TemplateAndFoldersSelectionForm(Form):
|
|||||||
None,
|
None,
|
||||||
[
|
[
|
||||||
# ('email', 'Email') if 'email' in available_template_types else None,
|
# ('email', 'Email') if 'email' in available_template_types else None,
|
||||||
("sms", "Start with a blank template")
|
(
|
||||||
if "sms" in available_template_types
|
("sms", "Start with a blank template")
|
||||||
else None,
|
if "sms" in available_template_types
|
||||||
("copy-existing", "Copy an existing template")
|
else None
|
||||||
if allow_adding_copy_of_template
|
),
|
||||||
else None,
|
(
|
||||||
|
("copy-existing", "Copy an existing template")
|
||||||
|
if allow_adding_copy_of_template
|
||||||
|
else None
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -168,12 +168,14 @@ def api_callbacks(service_id):
|
|||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"views/api/callbacks.html",
|
"views/api/callbacks.html",
|
||||||
received_text_messages_callback=received_text_messages_callback["url"]
|
received_text_messages_callback=(
|
||||||
if received_text_messages_callback
|
received_text_messages_callback["url"]
|
||||||
else None,
|
if received_text_messages_callback
|
||||||
delivery_status_callback=delivery_status_callback["url"]
|
else None
|
||||||
if delivery_status_callback
|
),
|
||||||
else None,
|
delivery_status_callback=(
|
||||||
|
delivery_status_callback["url"] if delivery_status_callback else None
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -262,9 +264,11 @@ def received_text_messages_callback(service_id):
|
|||||||
|
|
||||||
received_text_messages_callback = get_received_text_messages_callback()
|
received_text_messages_callback = get_received_text_messages_callback()
|
||||||
form = CallbackForm(
|
form = CallbackForm(
|
||||||
url=received_text_messages_callback.get("url")
|
url=(
|
||||||
if received_text_messages_callback
|
received_text_messages_callback.get("url")
|
||||||
else "",
|
if received_text_messages_callback
|
||||||
|
else ""
|
||||||
|
),
|
||||||
bearer_token=dummy_bearer_token if received_text_messages_callback else "",
|
bearer_token=dummy_bearer_token if received_text_messages_callback else "",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -122,16 +122,18 @@ def edit_user_permissions(service_id, user_id):
|
|||||||
form = form_class.from_user(
|
form = form_class.from_user(
|
||||||
user,
|
user,
|
||||||
service_id,
|
service_id,
|
||||||
folder_permissions=None
|
folder_permissions=(
|
||||||
if user.platform_admin
|
None
|
||||||
else [
|
if user.platform_admin
|
||||||
f["id"]
|
else [
|
||||||
for f in current_service.all_template_folders
|
f["id"]
|
||||||
if user.has_template_folder_permission(f)
|
for f in current_service.all_template_folders
|
||||||
],
|
if user.has_template_folder_permission(f)
|
||||||
all_template_folders=None
|
]
|
||||||
if user.platform_admin
|
),
|
||||||
else current_service.all_template_folders,
|
all_template_folders=(
|
||||||
|
None if user.platform_admin else current_service.all_template_folders
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ def performance():
|
|||||||
stats["average_percentage_under_10_seconds"] = mean(
|
stats["average_percentage_under_10_seconds"] = mean(
|
||||||
[row["percentage_under_10_seconds"] for row in stats["processing_time"]] or [0]
|
[row["percentage_under_10_seconds"] for row in stats["processing_time"]] or [0]
|
||||||
)
|
)
|
||||||
stats[
|
stats["count_of_live_services_and_organizations"] = (
|
||||||
"count_of_live_services_and_organizations"
|
status_api_client.get_count_of_live_services_and_organizations()
|
||||||
] = status_api_client.get_count_of_live_services_and_organizations()
|
)
|
||||||
|
|
||||||
return render_template("views/performance.html", **stats)
|
return render_template("views/performance.html", **stats)
|
||||||
|
|||||||
+16
-12
@@ -52,12 +52,14 @@ def get_example_csv_fields(column_headers, use_example_as_example, submitted_fie
|
|||||||
|
|
||||||
def get_example_csv_rows(template, use_example_as_example=True, submitted_fields=False):
|
def get_example_csv_rows(template, use_example_as_example=True, submitted_fields=False):
|
||||||
return {
|
return {
|
||||||
"email": ["test@example.com"]
|
"email": (
|
||||||
if use_example_as_example
|
["test@example.com"]
|
||||||
else [current_user.email_address],
|
if use_example_as_example
|
||||||
"sms": ["12223334444"]
|
else [current_user.email_address]
|
||||||
if use_example_as_example
|
),
|
||||||
else [current_user.mobile_number],
|
"sms": (
|
||||||
|
["12223334444"] if use_example_as_example else [current_user.mobile_number]
|
||||||
|
),
|
||||||
}[template.template_type] + get_example_csv_fields(
|
}[template.template_type] + get_example_csv_fields(
|
||||||
(
|
(
|
||||||
placeholder
|
placeholder
|
||||||
@@ -511,12 +513,14 @@ def _check_messages(service_id, template_id, upload_id, preview_row):
|
|||||||
template=template,
|
template=template,
|
||||||
max_initial_rows_shown=50,
|
max_initial_rows_shown=50,
|
||||||
max_errors_shown=50,
|
max_errors_shown=50,
|
||||||
guestlist=itertools.chain.from_iterable(
|
guestlist=(
|
||||||
[user.name, user.mobile_number, user.email_address]
|
itertools.chain.from_iterable(
|
||||||
for user in Users(service_id)
|
[user.name, user.mobile_number, user.email_address]
|
||||||
)
|
for user in Users(service_id)
|
||||||
if current_service.trial_mode
|
)
|
||||||
else None,
|
if current_service.trial_mode
|
||||||
|
else None
|
||||||
|
),
|
||||||
remaining_messages=remaining_messages,
|
remaining_messages=remaining_messages,
|
||||||
allow_international_sms=current_service.has_permission("international_sms"),
|
allow_international_sms=current_service.has_permission("international_sms"),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -477,9 +477,11 @@ def service_edit_email_reply_to(service_id, reply_to_email_id):
|
|||||||
current_service.id,
|
current_service.id,
|
||||||
reply_to_email_id=reply_to_email_id,
|
reply_to_email_id=reply_to_email_id,
|
||||||
email_address=form.email_address.data,
|
email_address=form.email_address.data,
|
||||||
is_default=True
|
is_default=(
|
||||||
if reply_to_email_address["is_default"]
|
True
|
||||||
else form.is_default.data,
|
if reply_to_email_address["is_default"]
|
||||||
|
else form.is_default.data
|
||||||
|
),
|
||||||
)
|
)
|
||||||
return redirect(url_for(".service_email_reply_to", service_id=service_id))
|
return redirect(url_for(".service_email_reply_to", service_id=service_id))
|
||||||
try:
|
try:
|
||||||
@@ -499,9 +501,11 @@ def service_edit_email_reply_to(service_id, reply_to_email_id):
|
|||||||
".service_verify_reply_to_address",
|
".service_verify_reply_to_address",
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
notification_id=notification_id,
|
notification_id=notification_id,
|
||||||
is_default=True
|
is_default=(
|
||||||
if reply_to_email_address["is_default"]
|
True
|
||||||
else form.is_default.data,
|
if reply_to_email_address["is_default"]
|
||||||
|
else form.is_default.data
|
||||||
|
),
|
||||||
replace=reply_to_email_id,
|
replace=reply_to_email_id,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -702,9 +706,11 @@ def service_edit_sms_sender(service_id, sms_sender_id):
|
|||||||
service_api_client.update_sms_sender(
|
service_api_client.update_sms_sender(
|
||||||
current_service.id,
|
current_service.id,
|
||||||
sms_sender_id=sms_sender_id,
|
sms_sender_id=sms_sender_id,
|
||||||
sms_sender=sms_sender["sms_sender"]
|
sms_sender=(
|
||||||
if is_inbound_number
|
sms_sender["sms_sender"]
|
||||||
else form.sms_sender.data.replace("\r", ""),
|
if is_inbound_number
|
||||||
|
else form.sms_sender.data.replace("\r", "")
|
||||||
|
),
|
||||||
is_default=True if sms_sender["is_default"] else form.is_default.data,
|
is_default=True if sms_sender["is_default"] else form.is_default.data,
|
||||||
)
|
)
|
||||||
return redirect(url_for(".service_sms_senders", service_id=service_id))
|
return redirect(url_for(".service_sms_senders", service_id=service_id))
|
||||||
|
|||||||
@@ -171,8 +171,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<p class="status-hint margin-0 width-card ">
|
<p class="status-hint margin-0 width-card ">
|
||||||
{{ notification.status|format_notification_status_as_time(
|
{{ notification.status|format_notification_status_as_time(
|
||||||
notification.created_at|format_datetime_short,
|
notification.created_at|format_datetime_short_america,
|
||||||
(notification.sent_at or notification.created_at)|format_datetime_short
|
(notification.sent_at or notification.created_at)|format_datetime_short_america
|
||||||
) }}
|
) }}
|
||||||
</p>
|
</p>
|
||||||
{% if displayed_on_single_line %}</span>{% endif %}
|
{% if displayed_on_single_line %}</span>{% endif %}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
<p class='bottom-gutter'>
|
<p class='bottom-gutter'>
|
||||||
{% if job.scheduled_for %}
|
{% if job.scheduled_for %}
|
||||||
{% if job.processing_started %}
|
{% if job.processing_started %}
|
||||||
Sent by {{ job.created_by.name }} on {{ job.processing_started|format_datetime_short }}
|
Sent by {{ job.created_by.name }} on {{ job.processing_started|format_datetime_short_america }}
|
||||||
{% else %}
|
{% else %}
|
||||||
Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
|
Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short_america }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
Sent by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
|
Sent by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short_america }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% if job.status == 'sending limits exceeded'%}
|
{% if job.status == 'sending limits exceeded'%}
|
||||||
|
|||||||
@@ -160,8 +160,8 @@ def test_can_show_notifications(
|
|||||||
assert normalize_spaces(
|
assert normalize_spaces(
|
||||||
first_row.select_one(".table-field-right-aligned .align-with-message-body").text
|
first_row.select_one(".table-field-right-aligned .align-with-message-body").text
|
||||||
) in [
|
) in [
|
||||||
"Delivered 1 January at 02:00 US/Eastern",
|
"Delivered 01-01-2020 at 01:00 AM",
|
||||||
"Delivered 1 January at 01:00 US/Eastern",
|
"Delivered 01-01-2020 at 01:00 AM",
|
||||||
]
|
]
|
||||||
|
|
||||||
assert page_title in page.h1.text.strip()
|
assert page_title in page.h1.text.strip()
|
||||||
@@ -656,36 +656,36 @@ def test_redacts_templates_that_should_be_redacted(
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("message_type", "status", "expected_hint_status", "single_line"),
|
("message_type", "status", "expected_hint_status", "single_line"),
|
||||||
[
|
[
|
||||||
("email", "created", "Sending since 27 September at 08:30 US/Eastern", True),
|
("email", "created", "Sending since 09-27-2017 at 08:30 AM", True),
|
||||||
("email", "sending", "Sending since 27 September at 08:30 US/Eastern", True),
|
("email", "sending", "Sending since 09-27-2017 at 08:30 AM", True),
|
||||||
(
|
(
|
||||||
"email",
|
"email",
|
||||||
"temporary-failure",
|
"temporary-failure",
|
||||||
"Inbox not accepting messages right now 27 September at 08:30 US/Eastern",
|
"Inbox not accepting messages right now 09-27-2017 at 08:30 AM",
|
||||||
False,
|
False,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"email",
|
"email",
|
||||||
"permanent-failure",
|
"permanent-failure",
|
||||||
"Email address does not exist 27 September at 08:30 US/Eastern",
|
"Email address does not exist 09-27-2017 at 08:30 AM",
|
||||||
False,
|
False,
|
||||||
),
|
),
|
||||||
("email", "delivered", "Delivered 27 September at 08:30 US/Eastern", True),
|
("email", "delivered", "Delivered 09-27-2017 at 08:30 AM", True),
|
||||||
("sms", "created", "Sending since 27 September at 08:30 US/Eastern", True),
|
("sms", "created", "Sending since 09-27-2017 at 08:30 AM", True),
|
||||||
("sms", "sending", "Sending since 27 September at 08:30 US/Eastern", True),
|
("sms", "sending", "Sending since 09-27-2017 at 08:30 AM", True),
|
||||||
(
|
(
|
||||||
"sms",
|
"sms",
|
||||||
"temporary-failure",
|
"temporary-failure",
|
||||||
"Phone not accepting messages right now 27 September at 08:30 US/Eastern",
|
"Phone not accepting messages right now 09-27-2017 at 08:30 AM",
|
||||||
False,
|
False,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"sms",
|
"sms",
|
||||||
"permanent-failure",
|
"permanent-failure",
|
||||||
"Not delivered 27 September at 08:30 US/Eastern",
|
"Not delivered 09-27-2017 at 08:30 AM",
|
||||||
False,
|
False,
|
||||||
),
|
),
|
||||||
("sms", "delivered", "Delivered 27 September at 08:30 US/Eastern", True),
|
("sms", "delivered", "Delivered 09-27-2017 at 08:30 AM", True),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_sending_status_hint_displays_correctly_on_notifications_page(
|
def test_sending_status_hint_displays_correctly_on_notifications_page(
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ def test_should_show_page_for_one_job(
|
|||||||
|
|
||||||
assert page.h1.text.strip() == "thisisatest.csv"
|
assert page.h1.text.strip() == "thisisatest.csv"
|
||||||
assert " ".join(page.find("tbody").find("tr").text.split()) == (
|
assert " ".join(page.find("tbody").find("tr").text.split()) == (
|
||||||
"2021234567 template content Delivered 1 January at 06:09 US/Eastern"
|
"2021234567 template content Delivered 01-01-2016 at 06:09 AM"
|
||||||
)
|
)
|
||||||
assert page.find("div", {"data-key": "notifications"})["data-resource"] == url_for(
|
assert page.find("div", {"data-key": "notifications"})["data-resource"] == url_for(
|
||||||
"main.view_job_updates",
|
"main.view_job_updates",
|
||||||
@@ -109,7 +109,7 @@ def test_should_show_page_for_one_job(
|
|||||||
assert page.find("span", {"id": "time-left"}).text == "Data available for 7 days"
|
assert page.find("span", {"id": "time-left"}).text == "Data available for 7 days"
|
||||||
|
|
||||||
assert normalize_spaces(page.select_one("tbody tr").text) == normalize_spaces(
|
assert normalize_spaces(page.select_one("tbody tr").text) == normalize_spaces(
|
||||||
"2021234567 " "template content " "Delivered 1 January at 06:09 US/Eastern"
|
"2021234567 " "template content " "Delivered 01-01-2016 at 06:09 AM"
|
||||||
)
|
)
|
||||||
assert page.select_one("tbody tr a")["href"] == url_for(
|
assert page.select_one("tbody tr a")["href"] == url_for(
|
||||||
"main.view_notification",
|
"main.view_notification",
|
||||||
@@ -424,8 +424,8 @@ def test_should_show_updates_for_one_job_as_json(
|
|||||||
assert "2021234567" in content["notifications"]
|
assert "2021234567" in content["notifications"]
|
||||||
assert "Status" in content["notifications"]
|
assert "Status" in content["notifications"]
|
||||||
assert "Delivered" in content["notifications"]
|
assert "Delivered" in content["notifications"]
|
||||||
assert "00:00" in content["notifications"]
|
assert "Sent by Test User on 01-01-2016 at 12:00 AM" in content["status"]
|
||||||
assert "Sent by Test User on 1 January at 00:00" in content["status"]
|
assert "12:00" in content["notifications"]
|
||||||
|
|
||||||
|
|
||||||
@freeze_time("2016-01-01 05:00:00.000001")
|
@freeze_time("2016-01-01 05:00:00.000001")
|
||||||
@@ -466,8 +466,8 @@ def test_should_show_updates_for_scheduled_job_as_json(
|
|||||||
assert "2021234567" in content["notifications"]
|
assert "2021234567" in content["notifications"]
|
||||||
assert "Status" in content["notifications"]
|
assert "Status" in content["notifications"]
|
||||||
assert "Delivered" in content["notifications"]
|
assert "Delivered" in content["notifications"]
|
||||||
assert "00:00" in content["notifications"]
|
assert "Sent by Test User on 06-01-2016 at 04:00 PM" in content["status"]
|
||||||
assert "Sent by Test User on 1 June at 16:00" in content["status"]
|
assert "12:00" in content["notifications"]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|||||||
Reference in New Issue
Block a user