diff --git a/src/registrar/admin.py b/src/registrar/admin.py index 7a3647582..64839da31 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -265,6 +265,8 @@ class DomainApplicationAdmin(ListHeaderAdmin): original_obj.submit(updated_domain_application=obj) elif obj.status == models.DomainApplication.INVESTIGATING: original_obj.in_review(updated_domain_application=obj) + elif obj.status == models.DomainApplication.ACTION_NEEDED: + original_obj.action_needed(updated_domain_application=obj) elif obj.status == models.DomainApplication.APPROVED: original_obj.approve(updated_domain_application=obj) elif obj.status == models.DomainApplication.WITHDRAWN: diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py index a50cb34b8..76e227447 100644 --- a/src/registrar/models/domain_application.py +++ b/src/registrar/models/domain_application.py @@ -18,16 +18,18 @@ class DomainApplication(TimeStampedModel): """A registrant's application for a new domain.""" - # #### Contants for choice fields #### + # #### Constants for choice fields #### STARTED = "started" SUBMITTED = "submitted" INVESTIGATING = "investigating" + ACTION_NEEDED = "action needed" APPROVED = "approved" WITHDRAWN = "withdrawn" STATUS_CHOICES = [ (STARTED, STARTED), (SUBMITTED, SUBMITTED), (INVESTIGATING, INVESTIGATING), + (ACTION_NEEDED, ACTION_NEEDED), (APPROVED, APPROVED), (WITHDRAWN, WITHDRAWN), ] @@ -497,7 +499,7 @@ class DomainApplication(TimeStampedModel): except EmailSendingError: logger.warning("Failed to send confirmation email", exc_info=True) - @transition(field="status", source=[STARTED, WITHDRAWN], target=SUBMITTED) + @transition(field="status", source=[STARTED, ACTION_NEEDED, WITHDRAWN], target=SUBMITTED) def submit(self, updated_domain_application=None): """Submit an application that is started. @@ -554,6 +556,18 @@ class DomainApplication(TimeStampedModel): "emails/status_change_in_review.txt", "emails/status_change_in_review_subject.txt", ) + + @transition(field="status", source=[INVESTIGATING], target=ACTION_NEEDED) + def action_needed(self, updated_domain_application): + """Send back an application that is under investigation or rejected. + + As a side effect, an email notification is sent, similar to in_review""" + + updated_domain_application._send_status_update_email( + "action needed", + "emails/status_change_action_needed.txt", + "emails/status_change_action_needed_subject.txt", + ) @transition(field="status", source=[SUBMITTED, INVESTIGATING], target=APPROVED) def approve(self, updated_domain_application=None): diff --git a/src/registrar/templates/application_status.html b/src/registrar/templates/application_status.html index 3d0f44a9f..c0904373f 100644 --- a/src/registrar/templates/application_status.html +++ b/src/registrar/templates/application_status.html @@ -21,6 +21,7 @@ {% if domainapplication.status == 'approved' %} Approved {% elif domainapplication.status == 'investigating' %} In Review + {% elif domainapplication.status == 'action needed' %} Action Needed {% elif domainapplication.status == 'submitted' %} Received {% else %}ERROR Please contact technical support/dev {% endif %} diff --git a/src/registrar/templates/emails/status_change_action_needed.txt b/src/registrar/templates/emails/status_change_action_needed.txt new file mode 100644 index 000000000..10bbc0087 --- /dev/null +++ b/src/registrar/templates/emails/status_change_action_needed.txt @@ -0,0 +1,43 @@ +{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #} +Hi {{ application.submitter.first_name }}. + +ACTION NEEDED: Your .gov domain request requires your attention. A CISA analyst will get in touch with you shortly with more details. + +DOMAIN REQUESTED: {{ application.requested_domain.name }} +REQUEST RECEIVED ON: {{ application.updated_at|date }} +REQUEST #: {{ application.id }} +STATUS: Action needed + + +NEED TO MAKE CHANGES? + +If you need to change your request you have to first withdraw it. Once you +withdraw the request you can edit it and submit it again. Changing your request +might add to the wait time. Learn more about withdrawing your request. +. + + +NEXT STEPS + +- We’re reviewing your request. This usually takes 20 business days. + +- You can check the status of your request at any time. + + +- We’ll email you with questions or when we complete our review. + + +THANK YOU + +.Gov helps the public identify official, trusted information. Thank you for +requesting a .gov domain. + +---------------------------------------------------------------- + +{% include 'emails/includes/application_summary.txt' %} +---------------------------------------------------------------- + +The .gov team +Contact us: +Visit +{% endautoescape %} diff --git a/src/registrar/templates/emails/status_change_action_needed_subject.txt b/src/registrar/templates/emails/status_change_action_needed_subject.txt new file mode 100644 index 000000000..f505dd45e --- /dev/null +++ b/src/registrar/templates/emails/status_change_action_needed_subject.txt @@ -0,0 +1 @@ +ACTION NEEDED: Your .gov domain request requires your attention \ No newline at end of file diff --git a/src/registrar/templates/home.html b/src/registrar/templates/home.html index aa2034a27..6163a1ce0 100644 --- a/src/registrar/templates/home.html +++ b/src/registrar/templates/home.html @@ -88,7 +88,7 @@ {{ application.created_at|date }} {{ application.status|title }} - {% if application.status == "started" or application.status == "withdrawn" %} + {% if application.status == "started" or application.status == "action needed" or application.status == "withdrawn" %}