Minor edits to not use kwargs and lint

This commit is contained in:
zandercymatics 2024-07-12 11:59:36 -06:00
parent 025a128bae
commit 6d63c9f868
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 19 additions and 10 deletions

View file

@ -1973,7 +1973,9 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
if domain_request.action_needed_reason == enum_value and domain_request.action_needed_reason_email: if domain_request.action_needed_reason == enum_value and domain_request.action_needed_reason_email:
custom_text = domain_request.action_needed_reason_email custom_text = domain_request.action_needed_reason_email
emails[enum_value] = self._get_action_needed_reason_default_email(domain_request, enum_value, custom_text) emails[enum_value] = self._get_action_needed_reason_default_email(
domain_request, enum_value, custom_text
)
return json.dumps(emails) return json.dumps(emails)
def _get_action_needed_reason_default_email(self, domain_request, action_needed_reason, custom_text=None): def _get_action_needed_reason_default_email(self, domain_request, action_needed_reason, custom_text=None):

View file

@ -612,8 +612,8 @@ class DomainRequest(TimeStampedModel):
super().save(*args, **kwargs) super().save(*args, **kwargs)
# Handle the action needed email. We send one when moving to action_needed, # Handle the action needed email.
# but we don't send one when we are _already_ in the state and change the reason. # An email is sent out when action_needed_reason is changed or added.
if self.status == self.DomainRequestStatus.ACTION_NEEDED and self.action_needed_reason: if self.status == self.DomainRequestStatus.ACTION_NEEDED and self.action_needed_reason:
self.sync_action_needed_reason() self.sync_action_needed_reason()
@ -683,7 +683,15 @@ class DomainRequest(TimeStampedModel):
logger.error(f"Can't query an approved domain while attempting {called_from}") logger.error(f"Can't query an approved domain while attempting {called_from}")
def _send_status_update_email( def _send_status_update_email(
self, new_status, email_template, email_template_subject, bcc_address="", context=None, **kwargs self,
new_status,
email_template,
email_template_subject,
bcc_address="",
context=None,
send_email=True,
wrap_email=False,
custom_email_content=None,
): ):
"""Send a status update email to the creator. """Send a status update email to the creator.
@ -694,7 +702,11 @@ class DomainRequest(TimeStampedModel):
If the waffle flag "profile_feature" is active, then this email will be sent to the If the waffle flag "profile_feature" is active, then this email will be sent to the
domain request creator rather than the submitter domain request creator rather than the submitter
kwargs: Optional args:
bcc_address: str -> the address to bcc to
context: dict -> The context sent to the template
send_email: bool -> Used to bypass the send_templated_email function, in the event send_email: bool -> Used to bypass the send_templated_email function, in the event
we just want to log that an email would have been sent, rather than actually sending one. we just want to log that an email would have been sent, rather than actually sending one.
@ -704,11 +716,6 @@ class DomainRequest(TimeStampedModel):
custom_email_content: str -> Renders an email with the content of this string as its body text. custom_email_content: str -> Renders an email with the content of this string as its body text.
""" """
# Email config options
wrap_email = kwargs.get("wrap_email", False)
send_email = kwargs.get("send_email", True)
custom_email_content = kwargs.get("custom_email_content", None)
recipient = self.creator if flag_is_active(None, "profile_feature") else self.submitter recipient = self.creator if flag_is_active(None, "profile_feature") else self.submitter
if recipient is None or recipient.email is None: if recipient is None or recipient.email is None:
logger.warning( logger.warning(