Now that EmailBranding includes the brand type we do not need two separate colours. This PR removes the new colour columns.

This commit is contained in:
Rebecca Law
2018-08-24 13:51:11 +01:00
parent 44818a91e7
commit 562facb49c
5 changed files with 10 additions and 64 deletions

View File

@@ -30,8 +30,7 @@ from app.models import (
NOTIFICATION_CREATED,
NOTIFICATION_TECHNICAL_FAILURE,
NOTIFICATION_SENT,
NOTIFICATION_SENDING,
BRANDING_BOTH
NOTIFICATION_SENDING
)
@@ -199,10 +198,8 @@ def get_html_email_options(service):
service.email_branding.logo
) if service.email_branding.logo else None
colour = _set_colour(service)
branding = {
'brand_colour': colour,
'brand_colour': service.email_branding.colour,
'brand_logo': logo_url,
'brand_name': service.email_branding.text,
}
@@ -212,15 +209,6 @@ def get_html_email_options(service):
return dict(govuk_banner=govuk_banner, brand_banner=brand_banner, **branding)
def _set_colour(service):
if service.branding in [BRANDING_BOTH, BRANDING_ORG]:
return service.email_branding.single_id_colour or service.email_branding.colour
elif service.branding == BRANDING_ORG_BANNER:
return service.email_branding.banner_colour or service.email_branding.colour
elif service.branding == BRANDING_GOVUK:
return None
def technical_failure(notification):
notification.status = NOTIFICATION_TECHNICAL_FAILURE
dao_update_notification(notification)

View File

@@ -6,8 +6,6 @@ post_create_email_branding_schema = {
"type": "object",
"properties": {
"colour": {"type": ["string", "null"]},
"banner_colour": {"type": ["string", "null"]},
"single_id_colour": {"type": ["string", "null"]},
"name": {"type": ["string", "null"]},
"text": {"type": ["string", "null"]},
"logo": {"type": ["string", "null"]},
@@ -23,8 +21,6 @@ post_update_email_branding_schema = {
"type": "object",
"properties": {
"colour": {"type": ["string", "null"]},
"banner_colour": {"type": ["string", "null"]},
"single_id_colour": {"type": ["string", "null"]},
"name": {"type": ["string", "null"]},
"text": {"type": ["string", "null"]},
"logo": {"type": ["string", "null"]},

View File

@@ -204,8 +204,6 @@ class EmailBranding(db.Model):
__tablename__ = 'email_branding'
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
colour = db.Column(db.String(7), nullable=True)
banner_colour = db.Column(db.String(7), nullable=True)
single_id_colour = db.Column(db.String(7), nullable=True)
logo = db.Column(db.String(255), nullable=True)
name = db.Column(db.String(255), nullable=True)
text = db.Column(db.String(255), nullable=True)
@@ -225,8 +223,6 @@ class EmailBranding(db.Model):
"logo": self.logo,
"name": self.name,
"text": self.text,
"banner_colour": self.banner_colour,
"single_id_colour": self.single_id_colour,
"domain": self.domain,
"brand_type": self.brand_type
}