Remove dependence on domains.yml from settings

Settings looked at `domains.yml` when users were making go live requests
or email branding requests.

This will allow us to remove the `domains.yml` file, by using
information about organisations that is now stored in the database
instead.
This commit is contained in:
Chris Hill-Scott
2019-04-04 11:23:40 +01:00
parent 835d11d8d6
commit 3565ffc33f
6 changed files with 72 additions and 54 deletions

View File

@@ -31,13 +31,12 @@ class Organisation(JSONModel):
def crown_status(self):
return self.crown
@property
def as_human_readable(self):
def as_human_readable(self, fallback_domain):
if 'dwp.' in ''.join(self.domains):
return 'DWP - Requires OED approval'
if self.agreement_signed:
return 'Yes, on behalf of {}'.format(self.name)
elif self.owner:
elif self.name:
return '{} (organisation is {}, {})'.format(
{
False: 'No',
@@ -51,11 +50,10 @@ class Organisation(JSONModel):
}.get(self.crown_status),
)
else:
return 'Cant tell (domain is {})'.format(self._domain)
return 'Cant tell (domain is {})'.format(fallback_domain)
@property
def as_info_for_branding_request(self):
return self.owner or 'Cant tell (domain is {})'.format(self._domain)
def as_info_for_branding_request(self, fallback_domain):
return self.name or 'Cant tell (domain is {})'.format(fallback_domain)
@property
def as_jinja_template(self):

View File

@@ -396,10 +396,6 @@ class Service(JSONModel):
organisations_client.get_service_organisation(self.id)
)
@property
def organisation_name(self):
return self.organisation.name
@cached_property
def inbound_number(self):
return inbound_number_client.get_inbound_sms_number_for_service(self.id)['data'].get('number', '')