From 8266635a7a2b486f2616ef86d32502904b26ba85 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Fri, 1 Feb 2019 17:24:04 +0000 Subject: [PATCH] remove dvla_organisation and other unused things dvla_organisation, branding_dict, a weird `branding` property on update_service. all gone :boom: --- app/main/forms.py | 21 --------------------- app/main/views/service_settings.py | 12 ------------ app/models/service.py | 1 - app/notify_client/letter_branding_client.py | 7 +------ app/notify_client/service_api_client.py | 2 -- 5 files changed, 1 insertion(+), 42 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index 759f522a3..6e8ab42f4 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -886,27 +886,6 @@ class CreateOrUpdateOrganisation(StripWhitespaceForm): name = StringField('Name', validators=[DataRequired()]) -class LetterBranding(StripWhitespaceForm): - - def __init__(self, choices=[], *args, **kwargs): - super().__init__(*args, **kwargs) - self.dvla_org_id.choices = list(sorted( - choices, - key=lambda choice: ( - choice[0] != kwargs.get('dvla_org_id'), - choice[0] != '001', - choice[1], - ), - )) - - dvla_org_id = RadioField( - 'Which logo should this service’s letter have?', - validators=[ - DataRequired() - ] - ) - - class EmailFieldInWhitelist(EmailField, StripWhitespaceStringField): pass diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index cb6e759f7..22b950755 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -31,7 +31,6 @@ from app.main.forms import ( ConfirmPasswordForm, FreeSMSAllowance, InternationalSMSForm, - LetterBranding, LinkOrganisationsForm, OrganisationTypeForm, RenameServiceForm, @@ -55,7 +54,6 @@ from app.main.forms import ( from app.utils import ( AgreementInfo, email_safe, - get_logo_cdn_domain, user_has_permissions, user_is_gov_user, user_is_platform_admin, @@ -775,7 +773,6 @@ def service_set_email_branding(service_id): return render_template( 'views/service-settings/set-email-branding.html', form=form, - branding_dict=get_branding_as_dict(email_branding), search_form=SearchTemplatesForm(), show_search_box=(len(email_branding) > 6) ) @@ -961,15 +958,6 @@ def get_branding_as_value_and_label(email_branding): ] -def get_branding_as_dict(email_branding): - return { - branding['id']: { - 'logo': 'https://{}/{}'.format(get_logo_cdn_domain(), branding['logo']), - 'colour': branding['colour'] - } for branding in email_branding - } - - def convert_dictionary_to_wtforms_choices_format(dictionary, value, label): return [ (item[value], item[label]) for item in dictionary diff --git a/app/models/service.py b/app/models/service.py index 036af98e1..8ecd722a2 100644 --- a/app/models/service.py +++ b/app/models/service.py @@ -23,7 +23,6 @@ class Service(): ALLOWED_PROPERTIES = { 'active', 'contact_link', - 'dvla_organisation', 'email_branding', 'email_from', 'id', diff --git a/app/notify_client/letter_branding_client.py b/app/notify_client/letter_branding_client.py index 9e6e90f21..2643e2f1e 100644 --- a/app/notify_client/letter_branding_client.py +++ b/app/notify_client/letter_branding_client.py @@ -14,12 +14,7 @@ class LetterBrandingClient(NotifyAdminAPIClient): brandings.sort(key=lambda branding: branding[sort_key].lower()) return brandings - def get_letter_branding_id_for_domain(self, domain): - for branding in self.get_all_letter_branding(): - if domain and branding.get('domain') == domain: - return branding['id'] - return None - + @cache.delete('letter_branding') def create_letter_branding(self, filename, name, domain): data = { "filename": filename, diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index c8bf7cf31..7bce1b2d3 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -74,11 +74,9 @@ class ServiceAPIClient(NotifyAdminAPIClient): 'research_mode', 'sms_sender', 'created_by', - 'branding', 'letter_branding', 'email_branding', 'letter_contact_block', - 'dvla_organisation', 'permissions', 'organisation_type', 'free_sms_fragment_limit',