Remove choosing postage from edit template content flow

This commit is contained in:
Pea Tyczynska
2019-01-29 16:39:47 +00:00
parent e85678fa69
commit 20ae200de9
5 changed files with 4 additions and 35 deletions

View File

@@ -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="Cant be empty")])

View File

@@ -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',

View File

@@ -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)

View File

@@ -18,9 +18,6 @@
<div class="grid-row">
<div class="column-five-sixths">
{{ textbox(form.name, width='1-1', hint='Your recipients wont 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(

View File

@@ -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 <em>content</em> 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(