Merge pull request #1660 from cisagov/za/1659-hide-default-email

Ticket #1659: Add default to csv_export, readd content
This commit is contained in:
zandercymatics 2024-01-19 15:06:57 -07:00 committed by GitHub
commit f31ca96aac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 4 deletions

View file

@ -20,7 +20,7 @@
<button <button
type="submit" type="submit"
class="usa-button" class="usa-button"
>{% if form.security_email.value is None or form.security_email.value == "dotgov@cisa.dhs.gov"%}Add security email{% else %}Save{% endif %}</button> >{% if form.security_email.value is None or form.security_email.value == "dotgov@cisa.dhs.gov" or form.security_email.value == "registrar@dotgov.gov"%}Add security email{% else %}Save{% endif %}</button>
</form> </form>
{% endblock %} {# domain_content #} {% endblock %} {# domain_content #}

View file

@ -399,7 +399,7 @@ class ExportDataTest(MockEppLib):
"adomain10.gov,Federal,Armed Forces Retirement Home,Ready\n" "adomain10.gov,Federal,Armed Forces Retirement Home,Ready\n"
"adomain2.gov,Interstate,(blank),Dns needed\n" "adomain2.gov,Interstate,(blank),Dns needed\n"
"ddomain3.gov,Federal,Armed Forces Retirement Home,123@mail.gov,On hold,2023-05-25\n" "ddomain3.gov,Federal,Armed Forces Retirement Home,123@mail.gov,On hold,2023-05-25\n"
"defaultsecurity.gov,Federal - Executive,World War I Centennial Commission,dotgov@cisa.dhs.gov,Ready" "defaultsecurity.gov,Federal - Executive,World War I Centennial Commission,(blank),Ready"
) )
# Normalize line endings and remove commas, # Normalize line endings and remove commas,

View file

@ -38,7 +38,7 @@ def write_row(writer, columns, domain_info):
if security_contacts: if security_contacts:
security_email = security_contacts[0].email security_email = security_contacts[0].email
invalid_emails = {"registrar@dotgov.gov"} invalid_emails = {"registrar@dotgov.gov", "dotgov@cisa.dhs.gov"}
# These are default emails that should not be displayed in the csv report # These are default emails that should not be displayed in the csv report
if security_email is not None and security_email.lower() in invalid_emails: if security_email is not None and security_email.lower() in invalid_emails:
security_email = "(blank)" security_email = "(blank)"

View file

@ -568,7 +568,9 @@ class DomainSecurityEmailView(DomainFormBaseView):
"""The initial value for the form.""" """The initial value for the form."""
initial = super().get_initial() initial = super().get_initial()
security_contact = self.object.security_contact security_contact = self.object.security_contact
if security_contact is None or security_contact.email == "dotgov@cisa.dhs.gov":
invalid_emails = ["dotgov@cisa.dhs.gov", "registrar@dotgov.gov"]
if security_contact is None or security_contact.email in invalid_emails:
initial["security_email"] = None initial["security_email"] = None
return initial return initial
initial["security_email"] = security_contact.email initial["security_email"] = security_contact.email