Only show contact lists relevant to template

You can’t send an email message template to a list of phone numbers. So
we shouldn’t show you the lists of phone numbers when you’ve chosen an
email template.
This commit is contained in:
Chris Hill-Scott
2020-03-16 09:41:42 +00:00
parent b598af1eca
commit 6c2021aeb2
5 changed files with 128 additions and 43 deletions

View File

@@ -498,9 +498,18 @@ def send_test_preview(service_id, template_id, filetype):
)
@user_has_permissions('send_messages')
def choose_from_contact_list(service_id, template_id):
db_template = current_service.get_template_with_user_permission_or_403(
template_id, current_user
)
template = get_template(
db_template, current_service,
)
return render_template(
'views/send-contact-list.html',
contact_lists=ContactLists(current_service.id),
contact_lists=ContactLists(
current_service.id,
template_type=template.template_type,
),
template=current_service.get_template(template_id),
)