diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 998e8971e..767b6220f 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -581,11 +581,8 @@ def edit_service_template(service_id, template_id): 'process_type': form.process_type.data, 'reply_to_text': template['reply_to_text'], } - if ( - current_service.has_permission("choose_postage") and template["template_type"] == "letter" - ) and form.postage.data in ["first", "second"]: - postage = {"postage": form.postage.data } - + if current_service.has_permission("choose_postage") and template["template_type"] == "letter": + postage = {"postage": form.postage.data} else: postage = {} diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index 75485e745..e74420413 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -153,7 +153,9 @@ class ServiceAPIClient(NotifyAdminAPIClient): @cache.delete('service-{service_id}-templates') @cache.delete('template-{id_}-version-None') @cache.delete('template-{id_}-versions') - def update_service_template(self, id_, name, type_, content, service_id, subject=None, process_type=None, postage=None): + def update_service_template( + self, id_, name, type_, content, service_id, subject=None, process_type=None, postage=None + ): """ Update a service template. """ @@ -172,10 +174,14 @@ class ServiceAPIClient(NotifyAdminAPIClient): data.update({ 'process_type': process_type }) - if postage: + if postage in ["first", "second"]: data.update({ 'postage': postage }) + elif postage == "service_default": + data.update({ + 'postage': None + }) data = _attach_current_user(data) endpoint = "/service/{0}/template/{1}".format(service_id, id_) return self.post(endpoint, data)