mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
Don’t go back to address if address placeholder in letter
If you have an placeholder from the address block elsewhere in your letter then you currently get redirected to the address block page instead of being offered to fill that placeholder in. This commit tightens up the check to only do this when the placeholder is in the first 7 placeholders, which is where we store the address placeholders.
This commit is contained in:
@@ -18,10 +18,7 @@ from notifications_python_client.errors import HTTPError
|
||||
from notifications_utils import LETTER_MAX_PAGE_COUNT, SMS_CHAR_COUNT_LIMIT
|
||||
from notifications_utils.columns import Columns
|
||||
from notifications_utils.pdf import is_letter_too_long
|
||||
from notifications_utils.postal_address import (
|
||||
PostalAddress,
|
||||
address_lines_1_to_6_and_postcode_keys,
|
||||
)
|
||||
from notifications_utils.postal_address import PostalAddress
|
||||
from notifications_utils.recipients import (
|
||||
RecipientCSV,
|
||||
first_column_headings,
|
||||
@@ -476,8 +473,8 @@ def send_test_step(service_id, template_id, step_index):
|
||||
))
|
||||
|
||||
# if we're in a letter, we should show address block rather than "address line #" or "postcode"
|
||||
if template.template_type == 'letter' and current_placeholder in (
|
||||
Columns.from_keys(address_lines_1_to_6_and_postcode_keys)
|
||||
if template.template_type == 'letter' and (
|
||||
step_index < len(first_column_headings['letter'])
|
||||
):
|
||||
return redirect(url_for('.send_one_off_letter_address', service_id=service_id, template_id=template_id))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user