mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-16 01:27:03 +02:00
additional comments, move log statements after the actions they're logging.
This commit is contained in:
parent
9c43fb65a9
commit
1ac56afe20
2 changed files with 13 additions and 6 deletions
|
@ -68,7 +68,7 @@ class DomainApplicationAdmin(AuditedAdmin):
|
|||
):
|
||||
# This is a transition annotated method in model which will throw an
|
||||
# error if the condition is violated. To make this work, we need to
|
||||
# call it on the original object which has the right status value,
|
||||
# call it on the original object which has the right status value,
|
||||
# but pass the current object which contains the up-to-date data
|
||||
# for the email.
|
||||
original_obj.in_review(obj)
|
||||
|
|
|
@ -484,15 +484,15 @@ class DomainApplication(TimeStampedModel):
|
|||
)
|
||||
return
|
||||
try:
|
||||
logger.info(
|
||||
f"Submission confirmation email sent to: {self.submitter.email}"
|
||||
)
|
||||
send_templated_email(
|
||||
"emails/submission_confirmation.txt",
|
||||
"emails/submission_confirmation_subject.txt",
|
||||
self.submitter.email,
|
||||
context={"application": self},
|
||||
)
|
||||
logger.info(
|
||||
f"Submission confirmation email sent to: {self.submitter.email}"
|
||||
)
|
||||
except EmailSendingError:
|
||||
logger.warning("Failed to send confirmation email", exc_info=True)
|
||||
|
||||
|
@ -510,13 +510,15 @@ class DomainApplication(TimeStampedModel):
|
|||
)
|
||||
return
|
||||
try:
|
||||
logging.info(f"In review email sent to: {self.submitter.email}")
|
||||
send_templated_email(
|
||||
"emails/status_change_in_review.txt",
|
||||
"emails/status_change_in_review_subject.txt",
|
||||
self.submitter.email,
|
||||
context={"application": self},
|
||||
)
|
||||
logging.info(
|
||||
f"In review email sent to: {self.submitter.email}"
|
||||
)
|
||||
except EmailSendingError:
|
||||
logger.warning(
|
||||
"Failed to send status change (in review) email", exc_info=True
|
||||
|
@ -572,7 +574,12 @@ class DomainApplication(TimeStampedModel):
|
|||
|
||||
@transition(field="status", source=SUBMITTED, target=INVESTIGATING)
|
||||
def in_review(self, updated_domain_application):
|
||||
"""Investigate an application that has been submitted."""
|
||||
"""Investigate an application that has been submitted.
|
||||
|
||||
This method is called in admin.py on the original application
|
||||
which has the correct status value, but is passed the changed
|
||||
application which has the up-to-date data that we'll use
|
||||
in the email."""
|
||||
|
||||
# When an application is moved to in review, we need to send a
|
||||
# confirmation email. This is a side-effect of the state transition
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue