mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-23 07:46:06 -04:00
Bug fix: Set default letter sender address on template creation
We spotted then when creating a new letter template it was not having the default letter sender address added to it. This commit fixes that bug by adding it if one exists. Note, use of new walrus operator https://docs.python.org/3/whatsnew/3.8.html#assignment-expressions
This commit is contained in:
@@ -96,8 +96,11 @@ def create_template(service_id):
|
||||
errors = {'template_type': [message]}
|
||||
raise InvalidRequest(errors, 403)
|
||||
|
||||
if not new_template.postage and new_template.template_type == LETTER_TYPE:
|
||||
new_template.postage = SECOND_CLASS
|
||||
if new_template.template_type == LETTER_TYPE:
|
||||
if default_letter_contact := fetched_service.get_default_letter_contact():
|
||||
new_template.reply_to = default_letter_contact.id
|
||||
if not new_template.postage:
|
||||
new_template.postage = SECOND_CLASS
|
||||
|
||||
new_template.service = fetched_service
|
||||
|
||||
|
||||
Reference in New Issue
Block a user