mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 10:03:21 -04:00
Different back links and form actions on verify page depending if add or change
This commit is contained in:
@@ -443,6 +443,7 @@ def service_verify_reply_to_address(service_id, notification_id):
|
|||||||
notification_id=notification_id,
|
notification_id=notification_id,
|
||||||
partials=get_service_verify_reply_to_address_partials(service_id, notification_id),
|
partials=get_service_verify_reply_to_address_partials(service_id, notification_id),
|
||||||
verb=("Change" if replace else "Add"),
|
verb=("Change" if replace else "Add"),
|
||||||
|
replace=replace,
|
||||||
request_args=request_args
|
request_args=request_args
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -458,12 +459,12 @@ def get_service_verify_reply_to_address_partials(service_id, notification_id):
|
|||||||
form = ServiceReplyToEmailForm()
|
form = ServiceReplyToEmailForm()
|
||||||
first_email_address = current_service.count_email_reply_to_addresses == 0
|
first_email_address = current_service.count_email_reply_to_addresses == 0
|
||||||
notification = notification_api_client.get_notification(current_app.config["NOTIFY_SERVICE_ID"], notification_id)
|
notification = notification_api_client.get_notification(current_app.config["NOTIFY_SERVICE_ID"], notification_id)
|
||||||
|
replace = request.args.get('replace', False)
|
||||||
verification_status = "pending"
|
verification_status = "pending"
|
||||||
is_default = True if (request.args.get('is_default', False) == "True") else False
|
is_default = True if (request.args.get('is_default', False) == "True") else False
|
||||||
if notification["status"] == "delivered":
|
if notification["status"] == "delivered":
|
||||||
verification_status = "success"
|
verification_status = "success"
|
||||||
if notification["to"] not in [i["email_address"] for i in current_service.email_reply_to_addresses]:
|
if notification["to"] not in [i["email_address"] for i in current_service.email_reply_to_addresses]:
|
||||||
replace = request.args.get('replace', False)
|
|
||||||
if replace and replace != "False":
|
if replace and replace != "False":
|
||||||
service_api_client.update_reply_to_email_address(
|
service_api_client.update_reply_to_email_address(
|
||||||
current_service.id, replace, email_address=notification["to"], is_default=is_default
|
current_service.id, replace, email_address=notification["to"], is_default=is_default
|
||||||
@@ -491,7 +492,8 @@ def get_service_verify_reply_to_address_partials(service_id, notification_id):
|
|||||||
verification_status=verification_status,
|
verification_status=verification_status,
|
||||||
is_default=is_default,
|
is_default=is_default,
|
||||||
form=form,
|
form=form,
|
||||||
first_email_address=first_email_address
|
first_email_address=first_email_address,
|
||||||
|
replace=replace
|
||||||
),
|
),
|
||||||
'stop': 0 if verification_status == "pending" else 1
|
'stop': 0 if verification_status == "pending" else 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,13 @@
|
|||||||
<p>
|
<p>
|
||||||
Do not use your own email address for replies.
|
Do not use your own email address for replies.
|
||||||
</p>
|
</p>
|
||||||
|
{% if replace %}
|
||||||
|
{% set form_url = url_for('.service_edit_email_reply_to', service_id=service_id, reply_to_email_id=replace) %}
|
||||||
|
{% else %}
|
||||||
|
{% set form_url = url_for('.service_add_email_reply_to', service_id=service_id) %}
|
||||||
|
{% endif %}
|
||||||
{% call form_wrapper(
|
{% call form_wrapper(
|
||||||
action = url_for('.service_add_email_reply_to', service_id=service_id)
|
action = form_url
|
||||||
) %}
|
) %}
|
||||||
{{ textbox(
|
{{ textbox(
|
||||||
form.email_address,
|
form.email_address,
|
||||||
|
|||||||
@@ -11,10 +11,14 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block maincolumn_content %}
|
{% block maincolumn_content %}
|
||||||
|
{% if replace %}
|
||||||
|
{% set back_link_href = url_for('.service_edit_email_reply_to', service_id=service_id, reply_to_email_id=replace) %}
|
||||||
|
{% else %}
|
||||||
|
{% set back_link_href = url_for('.service_add_email_reply_to', service_id=service_id) %}
|
||||||
|
{% endif %}
|
||||||
{{ page_header(
|
{{ page_header(
|
||||||
'{} email reply-to address'.format(verb),
|
'{} email reply-to address'.format(verb),
|
||||||
back_link=url_for('main.service_add_email_reply_to', service_id=current_service.id)
|
back_link=back_link_href
|
||||||
) }}
|
) }}
|
||||||
{{ ajax_block(
|
{{ ajax_block(
|
||||||
partials,
|
partials,
|
||||||
|
|||||||
@@ -2062,6 +2062,11 @@ def test_service_verify_reply_to_address(
|
|||||||
_optional_args="?is_default={}{}".format(is_default, replace)
|
_optional_args="?is_default={}{}".format(is_default, replace)
|
||||||
)
|
)
|
||||||
assert page.find('h1').text == '{} email reply-to address'.format(expected_header)
|
assert page.find('h1').text == '{} email reply-to address'.format(expected_header)
|
||||||
|
if replace:
|
||||||
|
assert "/email-reply-to/123/edit" in page.find('a', text="Back").attrs["href"]
|
||||||
|
else:
|
||||||
|
assert "/email-reply-to/add" in page.find('a', text="Back").attrs["href"]
|
||||||
|
|
||||||
assert len(page.find_all('div', class_='banner-dangerous')) == expected_failure
|
assert len(page.find_all('div', class_='banner-dangerous')) == expected_failure
|
||||||
assert len(page.find_all('div', class_='banner-default-with-tick')) == expected_success
|
assert len(page.find_all('div', class_='banner-default-with-tick')) == expected_success
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user