#1102 - Changed disclose behaviour

This commit is contained in:
zandercymatics 2023-10-03 11:18:38 -06:00
parent 4fa5f6d097
commit 67d177dc75
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 8 additions and 15 deletions

View file

@ -850,18 +850,15 @@ class Domain(TimeStampedModel, DomainHelper):
"""creates a disclose object that can be added to a contact Create using """creates a disclose object that can be added to a contact Create using
.disclose= <this function> on the command before sending. .disclose= <this function> on the command before sending.
if item is security email then make sure email is visable""" if item is security email then make sure email is visable"""
isSecurity = contact.contact_type == contact.ContactTypeChoices.SECURITY is_security = contact.contact_type == contact.ContactTypeChoices.SECURITY
DF = epp.DiscloseField DF = epp.DiscloseField
fields = {DF.FAX, DF.VOICE, DF.ADDR} fields = {DF.EMAIL}
disclose = (
if not isSecurity or ( is_security and contact.email != PublicContact.get_default_security().email
isSecurity and contact.email == PublicContact.get_default_security().email )
):
fields.add(DF.EMAIL)
return epp.Disclose( return epp.Disclose(
flag=False, flag=disclose,
fields=fields, fields=fields,
types={DF.ADDR: "loc"},
) )
def _make_epp_contact_postal_info(self, contact: PublicContact): # type: ignore def _make_epp_contact_postal_info(self, contact: PublicContact): # type: ignore

View file

@ -626,15 +626,11 @@ class MockEppLib(TestCase):
self, contact: PublicContact, disclose_email=False, createContact=True self, contact: PublicContact, disclose_email=False, createContact=True
): ):
DF = common.DiscloseField DF = common.DiscloseField
fields = {DF.FAX, DF.VOICE, DF.ADDR} fields = {DF.EMAIL}
if not disclose_email:
fields.add(DF.EMAIL)
di = common.Disclose( di = common.Disclose(
flag=False, flag=disclose_email,
fields=fields, fields=fields,
types={DF.ADDR: "loc"},
) )
# check docs here looks like we may have more than one address field but # check docs here looks like we may have more than one address field but