mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 14:18:24 -04:00
Apply sender to template when adding
If you’ve come from a template to add a new letter sender then it’s because you want those words on that template. This commit adds the extra API call to make that happen.
This commit is contained in:
@@ -706,14 +706,20 @@ def service_add_letter_contact(service_id):
|
||||
form = ServiceLetterContactBlockForm()
|
||||
first_contact_block = current_service.count_letter_contact_details == 0
|
||||
if form.validate_on_submit():
|
||||
service_api_client.add_letter_contact(
|
||||
new_letter_contact = service_api_client.add_letter_contact(
|
||||
current_service.id,
|
||||
contact_block=form.letter_contact_block.data.replace('\r', '') or None,
|
||||
is_default=first_contact_block if first_contact_block else form.is_default.data
|
||||
)
|
||||
if request.args.get('from_template'):
|
||||
from_template = request.args.get('from_template')
|
||||
if from_template:
|
||||
service_api_client.update_service_template_sender(
|
||||
service_id,
|
||||
from_template,
|
||||
new_letter_contact['data']['id'],
|
||||
)
|
||||
return redirect(
|
||||
url_for('.view_template', service_id=service_id, template_id=request.args.get('from_template'))
|
||||
url_for('.view_template', service_id=service_id, template_id=from_template)
|
||||
)
|
||||
return redirect(url_for('.service_letter_contact_details', service_id=service_id))
|
||||
return render_template(
|
||||
|
||||
Reference in New Issue
Block a user