mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 13:39:41 -04:00
Fix logic for showing and hiding checkbox
The ‘make this default’ checkbox should be shown, except when: - the user is adding their first email reply to address (because the first one has to be the default) - they’re editing the existing default (because they can’t change it to be not default)
This commit is contained in:
@@ -474,12 +474,17 @@ def get_service_verify_reply_to_address_partials(service_id, notification_id):
|
||||
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)
|
||||
replace = request.args.get('replace', False)
|
||||
replace = False if replace == "False" else replace
|
||||
existing_is_default = False
|
||||
if replace:
|
||||
existing = current_service.get_email_reply_to_address(replace)
|
||||
existing_is_default = existing['is_default']
|
||||
verification_status = "pending"
|
||||
is_default = True if (request.args.get('is_default', False) == "True") else False
|
||||
if notification["status"] in DELIVERED_STATUSES:
|
||||
verification_status = "success"
|
||||
if notification["to"] not in [i["email_address"] for i in current_service.email_reply_to_addresses]:
|
||||
if replace and replace != "False":
|
||||
if replace:
|
||||
service_api_client.update_reply_to_email_address(
|
||||
current_service.id, replace, email_address=notification["to"], is_default=is_default
|
||||
)
|
||||
@@ -505,6 +510,7 @@ def get_service_verify_reply_to_address_partials(service_id, notification_id):
|
||||
notification_id=notification_id,
|
||||
verification_status=verification_status,
|
||||
is_default=is_default,
|
||||
existing_is_default=existing_is_default,
|
||||
form=form,
|
||||
first_email_address=first_email_address,
|
||||
replace=replace
|
||||
|
||||
Reference in New Issue
Block a user