mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-03 23:51:22 -04:00
Add canonical domain info to agreement class
Because we alias domains (eg `foo.gsi.gov.uk` to `foo.gov.uk`, or where a local council has multiple domains) it could be hard to look up a brand (which has one domain field). Therefore we need a way of getting the canonical domain from a user’s email address, which we can later use to look up their branding.
This commit is contained in:
@@ -445,7 +445,8 @@ class AgreementInfo:
|
||||
(
|
||||
self.owner,
|
||||
self.crown_status,
|
||||
self.agreement_signed
|
||||
self.agreement_signed,
|
||||
self.canonical_domain,
|
||||
) = self._get_info()
|
||||
|
||||
@classmethod
|
||||
@@ -584,13 +585,16 @@ class AgreementInfo:
|
||||
details = self.domains.get(self._match) or {}
|
||||
|
||||
if isinstance(details, str):
|
||||
self.is_canonical = False
|
||||
return AgreementInfo(details)._get_info()
|
||||
|
||||
elif isinstance(details, dict):
|
||||
self.is_canonical = bool(details)
|
||||
return(
|
||||
details.get("owner"),
|
||||
details.get("crown"),
|
||||
details.get("agreement_signed"),
|
||||
self._match,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user