From 20ae200de9e5a36567533f121906d531a1d5a19d Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Tue, 29 Jan 2019 16:39:47 +0000 Subject: [PATCH] Remove choosing postage from edit template content flow --- app/main/forms.py | 11 ----------- app/main/views/templates.py | 8 -------- app/notify_client/service_api_client.py | 10 +--------- app/templates/views/edit-letter-template.html | 3 --- tests/app/main/views/test_templates.py | 7 +++---- 5 files changed, 4 insertions(+), 35 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index 7ebf99f8b..7538c27c5 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -447,17 +447,6 @@ class EmailTemplateForm(BaseTemplateForm): class LetterTemplateForm(EmailTemplateForm): - postage = RadioField( - 'Choose postage', - choices=[ - ('first', 'First class'), - ('second', 'Second class'), - ('None', "Service default"), - ], - validators=[DataRequired()], - default='None' - ) - subject = TextAreaField( u'Main heading', validators=[DataRequired(message="Can’t be empty")]) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 195d291e6..8bfcbd51e 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -614,12 +614,6 @@ 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": - postage = {"postage": form.postage.data} - else: - postage = {} - - new_template_data.update(postage) new_template = get_template(new_template_data, current_service) template_change = get_template(template, current_service).compare_to(new_template) @@ -648,7 +642,6 @@ def edit_service_template(service_id, template_id): service_id, subject, form.process_type.data, - postage=postage.get("postage") ) except HTTPError as e: if e.status_code == 400: @@ -679,7 +672,6 @@ def edit_service_template(service_id, template_id): return render_template( 'views/edit-{}-template.html'.format(template['template_type']), form=form, - can_choose_postage=current_service.has_permission("choose_postage"), template_id=template_id, template_type=template['template_type'], heading_action='Edit', diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index 9c1f25603..4b4b87ea1 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -150,7 +150,7 @@ class ServiceAPIClient(NotifyAdminAPIClient): @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 + self, id_, name, type_, content, service_id, subject=None, process_type=None ): """ Update a service template. @@ -170,14 +170,6 @@ class ServiceAPIClient(NotifyAdminAPIClient): data.update({ 'process_type': process_type }) - if postage in ["first", "second"]: - data.update({ - 'postage': postage - }) - elif postage == 'None': - data.update({ - 'postage': None - }) data = _attach_current_user(data) endpoint = "/service/{0}/template/{1}".format(service_id, id_) return self.post(endpoint, data) diff --git a/app/templates/views/edit-letter-template.html b/app/templates/views/edit-letter-template.html index 6884c67a7..d78ba19f6 100644 --- a/app/templates/views/edit-letter-template.html +++ b/app/templates/views/edit-letter-template.html @@ -18,9 +18,6 @@
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this', rows=10) }} - {% if can_choose_postage %} - {{ radios(form.postage, hint='Go to Settings to change default postage for your service') }} - {% endif %} {{ textbox(form.subject, width='1-1', highlight_tags=True, rows=2) }} {{ textbox(form.template_content, highlight_tags=True, width='1-1', rows=8) }} {{ sticky_page_footer( diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 13619541a..937574173 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -1320,7 +1320,7 @@ def test_should_redirect_when_saving_a_template( assert response.location == url_for( '.view_template', service_id=service['id'], template_id=template_id, _external=True) mock_update_service_template.assert_called_with( - template_id, name, 'sms', content, service['id'], None, 'normal', postage=None) + template_id, name, 'sms', content, service['id'], None, 'normal') def test_should_edit_content_when_process_type_is_priority_not_platform_admin( @@ -1356,8 +1356,7 @@ def test_should_edit_content_when_process_type_is_priority_not_platform_admin( "new template content with & entity", service['id'], None, - 'priority', - postage=None + 'priority' ) @@ -1646,7 +1645,7 @@ def test_should_redirect_when_saving_a_template_email( template_id=template_id, _external=True) mock_update_service_template.assert_called_with( - template_id, name, 'email', content, service_id, subject, 'normal', postage=None) + template_id, name, 'email', content, service_id, subject, 'normal') def test_should_show_delete_template_page_with_time_block(