{% endif %}
{% endblock %}
-
diff --git a/src/registrar/templates/django/admin/domain_invitation_change_form.html b/src/registrar/templates/django/admin/domain_invitation_change_form.html
index 6ce6ed0d1..699760fa8 100644
--- a/src/registrar/templates/django/admin/domain_invitation_change_form.html
+++ b/src/registrar/templates/django/admin/domain_invitation_change_form.html
@@ -11,4 +11,4 @@
{{ block.super }}
-{% endblock %}
+{% endblock %}
\ No newline at end of file
diff --git a/src/registrar/templates/domain_detail.html b/src/registrar/templates/domain_detail.html
index 758c43366..57749f038 100644
--- a/src/registrar/templates/domain_detail.html
+++ b/src/registrar/templates/domain_detail.html
@@ -35,7 +35,7 @@
{# UNKNOWN domains would not have an expiration date and thus would show 'Expired' #}
{% if domain.is_expired and domain.state != domain.State.UNKNOWN %}
Expired
- {% elif has_domain_renewal_flag and domain.is_expiring %}
+ {% elif domain.is_expiring %}
Expiring soon
{% elif domain.state == domain.State.UNKNOWN or domain.state == domain.State.DNS_NEEDED %}
DNS needed
@@ -46,17 +46,17 @@
{% if domain.get_state_help_text %}
- {% if has_domain_renewal_flag and domain.is_expired and is_domain_manager %}
+ {% if domain.is_expired and is_domain_manager %}
This domain has expired, but it is still online.
{% url 'domain-renewal' pk=domain.id as url %}
Renew to maintain access.
- {% elif has_domain_renewal_flag and domain.is_expiring and is_domain_manager %}
+ {% elif domain.is_expiring and is_domain_manager %}
This domain will expire soon.
{% url 'domain-renewal' pk=domain.id as url %}
Renew to maintain access.
- {% elif has_domain_renewal_flag and domain.is_expiring and is_portfolio_user %}
+ {% elif domain.is_expiring and is_portfolio_user %}
This domain will expire soon. Contact one of the listed domain managers to renew the domain.
- {% elif has_domain_renewal_flag and domain.is_expired and is_portfolio_user %}
+ {% elif domain.is_expired and is_portfolio_user %}
This domain has expired, but it is still online. Contact one of the listed domain managers to renew the domain.
{% else %}
{{ domain.get_state_help_text }}
diff --git a/src/registrar/templates/domain_sidebar.html b/src/registrar/templates/domain_sidebar.html
index 5946b6859..3302a6a79 100644
--- a/src/registrar/templates/domain_sidebar.html
+++ b/src/registrar/templates/domain_sidebar.html
@@ -81,7 +81,7 @@
{% endwith %}
- {% if has_domain_renewal_flag and is_domain_manager%}
+ {% if is_domain_manager%}
{% if domain.is_expiring or domain.is_expired %}
{% with url_name="domain-renewal" %}
{% include "includes/domain_sidenav_item.html" with item_text="Renewal form" %}
diff --git a/src/registrar/templates/emails/action_needed_reasons/bad_name.txt b/src/registrar/templates/emails/action_needed_reasons/bad_name.txt
index ac563b549..40e5ed899 100644
--- a/src/registrar/templates/emails/action_needed_reasons/bad_name.txt
+++ b/src/registrar/templates/emails/action_needed_reasons/bad_name.txt
@@ -17,7 +17,7 @@ Domains should uniquely identify a government organization and be clear to the g
ACTION NEEDED
-First, we need you to identify a new domain name that meets our naming requirements for your type of organization. Then, log in to the registrar and update the name in your domain request. Once you submit your updated request, we’ll resume the adjudication process.
+First, we need you to identify a new domain name that meets our naming requirements for your type of organization. Then, log in to the registrar and update the name in your domain request. <{{ manage_url }}> Once you submit your updated request, we’ll resume the adjudication process.
If you have questions or want to discuss potential domain names, reply to this email.
diff --git a/src/registrar/templates/emails/action_needed_reasons/questionable_senior_official.txt b/src/registrar/templates/emails/action_needed_reasons/questionable_senior_official.txt
index ef05e17d7..40d068cd9 100644
--- a/src/registrar/templates/emails/action_needed_reasons/questionable_senior_official.txt
+++ b/src/registrar/templates/emails/action_needed_reasons/questionable_senior_official.txt
@@ -21,7 +21,7 @@ We expect a senior official to be someone in a role of significant, executive re
ACTION NEEDED
Reply to this email with a justification for naming {{ domain_request.senior_official.get_formatted_name }} as the senior official. If you have questions or comments, include those in your reply.
-Alternatively, you can log in to the registrar and enter a different senior official for this domain request. Once you submit your updated request, we’ll resume the adjudication process.
+Alternatively, you can log in to the registrar and enter a different senior official for this domain request. <{{ manage_url }}> Once you submit your updated request, we’ll resume the adjudication process.
THANK YOU
diff --git a/src/registrar/templates/emails/domain_invitation.txt b/src/registrar/templates/emails/domain_invitation.txt
index a077bff26..270786a7a 100644
--- a/src/registrar/templates/emails/domain_invitation.txt
+++ b/src/registrar/templates/emails/domain_invitation.txt
@@ -4,7 +4,7 @@ Hi,{% if requested_user and requested_user.first_name %} {{ requested_user.first
{{ requestor_email }} has invited you to manage:
{% for domain in domains %}{{ domain.name }}
{% endfor %}
-To manage domain information, visit the .gov registrar .
+To manage domain information, visit the .gov registrar <{{ manage_url }}>.
----------------------------------------------------------------
{% if not requested_user %}
diff --git a/src/registrar/templates/emails/domain_manager_notification.txt b/src/registrar/templates/emails/domain_manager_notification.txt
index c253937e4..b5096a9d8 100644
--- a/src/registrar/templates/emails/domain_manager_notification.txt
+++ b/src/registrar/templates/emails/domain_manager_notification.txt
@@ -15,7 +15,7 @@ The person who received the invitation will become a domain manager once they lo
associated with the invited email address.
If you need to cancel this invitation or remove the domain manager, you can do that by going to
-this domain in the .gov registrar .
+this domain in the .gov registrar <{{ manage_url }}>.
WHY DID YOU RECEIVE THIS EMAIL?
diff --git a/src/registrar/templates/emails/domain_request_withdrawn.txt b/src/registrar/templates/emails/domain_request_withdrawn.txt
index fbdf5b4f1..fe026027b 100644
--- a/src/registrar/templates/emails/domain_request_withdrawn.txt
+++ b/src/registrar/templates/emails/domain_request_withdrawn.txt
@@ -11,7 +11,7 @@ STATUS: Withdrawn
----------------------------------------------------------------
YOU CAN EDIT YOUR WITHDRAWN REQUEST
-You can edit and resubmit this request by signing in to the registrar .
+You can edit and resubmit this request by signing in to the registrar <{{ manage_url }}>.
SOMETHING WRONG?
diff --git a/src/registrar/templates/emails/portfolio_admin_addition_notification.txt b/src/registrar/templates/emails/portfolio_admin_addition_notification.txt
index b8953aa67..9e6da3985 100644
--- a/src/registrar/templates/emails/portfolio_admin_addition_notification.txt
+++ b/src/registrar/templates/emails/portfolio_admin_addition_notification.txt
@@ -16,7 +16,7 @@ The person who received the invitation will become an admin once they log in to
associated with the invited email address.
If you need to cancel this invitation or remove the admin, you can do that by going to
-the Members section for your organization .
+the Members section for your organization <{{ manage_url }}>.
WHY DID YOU RECEIVE THIS EMAIL?
diff --git a/src/registrar/templates/emails/portfolio_admin_removal_notification.txt b/src/registrar/templates/emails/portfolio_admin_removal_notification.txt
index 6a536aa49..bf0338c03 100644
--- a/src/registrar/templates/emails/portfolio_admin_removal_notification.txt
+++ b/src/registrar/templates/emails/portfolio_admin_removal_notification.txt
@@ -8,7 +8,7 @@ REMOVED BY: {{ requestor_email }}
REMOVED ON: {{date}}
ADMIN REMOVED: {{ removed_email_address }}
-You can view this update by going to the Members section for your .gov organization .
+You can view this update by going to the Members section for your .gov organization <{{ manage_url }}>.
----------------------------------------------------------------
diff --git a/src/registrar/templates/emails/portfolio_invitation.txt b/src/registrar/templates/emails/portfolio_invitation.txt
index 775b74c7c..893da153d 100644
--- a/src/registrar/templates/emails/portfolio_invitation.txt
+++ b/src/registrar/templates/emails/portfolio_invitation.txt
@@ -3,7 +3,7 @@ Hi.
{{ requestor_email }} has invited you to {{ portfolio.organization_name }}.
-You can view this organization on the .gov registrar .
+You can view this organization on the .gov registrar <{{ manage_url }}>.
----------------------------------------------------------------
diff --git a/src/registrar/templates/emails/status_change_approved.txt b/src/registrar/templates/emails/status_change_approved.txt
index 821e89e42..635b36cbd 100644
--- a/src/registrar/templates/emails/status_change_approved.txt
+++ b/src/registrar/templates/emails/status_change_approved.txt
@@ -8,7 +8,7 @@ REQUESTED BY: {{ domain_request.creator.email }}
REQUEST RECEIVED ON: {{ domain_request.last_submitted_date|date }}
STATUS: Approved
-You can manage your approved domain on the .gov registrar .
+You can manage your approved domain on the .gov registrar <{{ manage_url }}>.
----------------------------------------------------------------
diff --git a/src/registrar/templates/emails/submission_confirmation.txt b/src/registrar/templates/emails/submission_confirmation.txt
index d9d01ec3e..afbde48d5 100644
--- a/src/registrar/templates/emails/submission_confirmation.txt
+++ b/src/registrar/templates/emails/submission_confirmation.txt
@@ -20,7 +20,7 @@ During our review, we’ll verify that:
- You work at the organization and/or can make requests on its behalf
- Your requested domain meets our naming requirements
{% endif %}
-We’ll email you if we have questions. We’ll also email you as soon as we complete our review. You can check the status of your request at any time on the registrar. .
+We’ll email you if we have questions. We’ll also email you as soon as we complete our review. You can check the status of your request at any time on the registrar. <{{ manage_url }}>.
NEED TO MAKE CHANGES?
diff --git a/src/registrar/templates/emails/transition_domain_invitation.txt b/src/registrar/templates/emails/transition_domain_invitation.txt
index b6773d9e9..14dd626dd 100644
--- a/src/registrar/templates/emails/transition_domain_invitation.txt
+++ b/src/registrar/templates/emails/transition_domain_invitation.txt
@@ -31,7 +31,7 @@ CHECK YOUR .GOV DOMAIN CONTACTS
This is a good time to check who has access to your .gov domain{% if domains|length > 1 %}s{% endif %}. The admin, technical, and billing contacts listed for your domain{% if domains|length > 1 %}s{% endif %} in our old system also received this email. In our new registrar, these contacts are all considered “domain managers.” We no longer have the admin, technical, and billing roles, and you aren’t limited to three domain managers like in the old system.
- 1. Once you have your Login.gov account, sign in to the new registrar at .
+ 1. Once you have your Login.gov account, sign in to the new registrar at <{{ manage_url }}>.
2. Click the “Manage” link next to your .gov domain, then click on “Domain managers” to see who has access to your domain.
3. If any of these users should not have access to your domain, let us know in a reply to this email.
@@ -57,7 +57,7 @@ THANK YOU
The .gov team
.Gov blog
-Domain management
+Domain management <{{ manage_url }}}>
Get.gov
The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA)
diff --git a/src/registrar/templates/emails/update_to_approved_domain.txt b/src/registrar/templates/emails/update_to_approved_domain.txt
index 99f86ea54..070096f62 100644
--- a/src/registrar/templates/emails/update_to_approved_domain.txt
+++ b/src/registrar/templates/emails/update_to_approved_domain.txt
@@ -8,7 +8,7 @@ UPDATED BY: {{user}}
UPDATED ON: {{date}}
INFORMATION UPDATED: {{changes}}
-You can view this update in the .gov registrar .
+You can view this update in the .gov registrar <{{ manage_url }}>.
Get help with managing your .gov domain .
diff --git a/src/registrar/templates/includes/domains_table.html b/src/registrar/templates/includes/domains_table.html
index 94cb4ea6d..3cf04a830 100644
--- a/src/registrar/templates/includes/domains_table.html
+++ b/src/registrar/templates/includes/domains_table.html
@@ -9,7 +9,7 @@
{{url}}
-{% if has_domain_renewal_flag and num_expiring_domains > 0 and has_any_domains_portfolio_permission %}
+{% if num_expiring_domains > 0 and has_any_domains_portfolio_permission %}
@@ -75,7 +75,7 @@
- {% if has_domain_renewal_flag and num_expiring_domains > 0 and not portfolio %}
+ {% if num_expiring_domains > 0 and not portfolio %}
@@ -173,7 +173,6 @@
>Deleted
- {% if has_domain_renewal_flag %}
Expiring soon
- {% endif %}
diff --git a/src/registrar/tests/test_admin_domain.py b/src/registrar/tests/test_admin_domain.py
index 867bf1b82..4cae9a9e0 100644
--- a/src/registrar/tests/test_admin_domain.py
+++ b/src/registrar/tests/test_admin_domain.py
@@ -12,6 +12,7 @@ from registrar.models import (
Domain,
DomainRequest,
DomainInformation,
+ DomainInvitation,
User,
Host,
Portfolio,
@@ -495,6 +496,107 @@ class TestDomainInformationInline(MockEppLib):
self.assertIn("poopy@gov.gov", domain_managers)
+class TestDomainInvitationAdmin(TestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.staffuser = create_user(email="staffdomainmanager@meoward.com", is_staff=True)
+ cls.site = AdminSite()
+ cls.admin = DomainAdmin(model=Domain, admin_site=cls.site)
+ cls.factory = RequestFactory()
+
+ def setUp(self):
+ self.client = Client(HTTP_HOST="localhost:8080")
+ self.client.force_login(self.staffuser)
+ super().setUp()
+
+ def test_successful_cancel_invitation_flow_in_admin(self):
+ """Testing canceling a domain invitation in Django Admin."""
+
+ # 1. Create a domain and assign staff user role + domain manager
+ domain = Domain.objects.create(name="cancelinvitationflowviaadmin.gov")
+ UserDomainRole.objects.create(user=self.staffuser, domain=domain, role="manager")
+
+ # 2. Invite a domain manager to the above domain
+ invitation = DomainInvitation.objects.create(
+ email="inviteddomainmanager@meoward.com",
+ domain=domain,
+ status=DomainInvitation.DomainInvitationStatus.INVITED,
+ )
+
+ # 3. Go to the Domain Invitations list in /admin
+ domain_invitation_list_url = reverse("admin:registrar_domaininvitation_changelist")
+ response = self.client.get(domain_invitation_list_url)
+ self.assertEqual(response.status_code, 200)
+
+ # 4. Go to the change view of that invitation and make sure you can see the button
+ domain_invitation_change_url = reverse("admin:registrar_domaininvitation_change", args=[invitation.id])
+ response = self.client.get(domain_invitation_change_url)
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response, "Cancel invitation")
+
+ # 5. Click the cancel invitation button
+ response = self.client.post(domain_invitation_change_url, {"cancel_invitation": "true"}, follow=True)
+
+ # 6. Make sure we're redirect back to the change view page in /admin
+ self.assertRedirects(response, domain_invitation_change_url)
+
+ # 7. Confirm cancellation confirmation message appears
+ expected_message = f"Invitation for {invitation.email} on {domain.name} is canceled"
+ self.assertContains(response, expected_message)
+
+ def test_no_cancel_invitation_button_in_retrieved_state(self):
+ """Shouldn't be able to see the "Cancel invitation" button if invitation is RETRIEVED state"""
+
+ # 1. Create a domain and assign staff user role + domain manager
+ domain = Domain.objects.create(name="retrieved.gov")
+ UserDomainRole.objects.create(user=self.staffuser, domain=domain, role="manager")
+
+ # 2. Invite a domain manager to the above domain and NOT in invited state
+ invitation = DomainInvitation.objects.create(
+ email="retrievedinvitation@meoward.com",
+ domain=domain,
+ status=DomainInvitation.DomainInvitationStatus.RETRIEVED,
+ )
+
+ # 3. Go to the Domain Invitations list in /admin
+ domain_invitation_list_url = reverse("admin:registrar_domaininvitation_changelist")
+ response = self.client.get(domain_invitation_list_url)
+ self.assertEqual(response.status_code, 200)
+
+ # 4. Go to the change view of that invitation and make sure you CANNOT see the button
+ domain_invitation_change_url = reverse("admin:registrar_domaininvitation_change", args=[invitation.id])
+ response = self.client.get(domain_invitation_change_url)
+ self.assertEqual(response.status_code, 200)
+ self.assertNotContains(response, "Cancel invitation")
+
+ def test_no_cancel_invitation_button_in_canceled_state(self):
+ """Shouldn't be able to see the "Cancel invitation" button if invitation is CANCELED state"""
+
+ # 1. Create a domain and assign staff user role + domain manager
+ domain = Domain.objects.create(name="canceled.gov")
+ UserDomainRole.objects.create(user=self.staffuser, domain=domain, role="manager")
+
+ # 2. Invite a domain manager to the above domain and NOT in invited state
+ invitation = DomainInvitation.objects.create(
+ email="canceledinvitation@meoward.com",
+ domain=domain,
+ status=DomainInvitation.DomainInvitationStatus.CANCELED,
+ )
+
+ # 3. Go to the Domain Invitations list in /admin
+ domain_invitation_list_url = reverse("admin:registrar_domaininvitation_changelist")
+ response = self.client.get(domain_invitation_list_url)
+ self.assertEqual(response.status_code, 200)
+
+ # 4. Go to the change view of that invitation and make sure you CANNOT see the button
+ domain_invitation_change_url = reverse("admin:registrar_domaininvitation_change", args=[invitation.id])
+ response = self.client.get(domain_invitation_change_url)
+ self.assertEqual(response.status_code, 200)
+ self.assertNotContains(response, "Cancel invitation")
+
+
class TestDomainAdminWithClient(TestCase):
"""Test DomainAdmin class as super user.
diff --git a/src/registrar/tests/test_emails.py b/src/registrar/tests/test_emails.py
index f39f11517..2b7f89ac9 100644
--- a/src/registrar/tests/test_emails.py
+++ b/src/registrar/tests/test_emails.py
@@ -108,6 +108,82 @@ class TestEmails(TestCase):
self.assertEqual(["testy2@town.com", "mayor@igorville.gov"], kwargs["Destination"]["CcAddresses"])
+ @boto3_mocking.patching
+ @override_settings(IS_PRODUCTION=True, BASE_URL="manage.get.gov")
+ def test_email_production_subject_and_url_check(self):
+ """Test sending an email in production that:
+ 1. Does not have a prefix in the email subject (no [MANAGE])
+ 2. Uses the production URL in the email body of manage.get.gov still"""
+ with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class):
+ send_templated_email(
+ "emails/update_to_approved_domain.txt",
+ "emails/update_to_approved_domain_subject.txt",
+ "doesnotexist@igorville.com",
+ context={"domain": "test", "user": "test", "date": 1, "changes": "test"},
+ bcc_address=None,
+ cc_addresses=["testy2@town.com", "mayor@igorville.gov"],
+ )
+
+ # check that an email was sent
+ self.assertTrue(self.mock_client.send_email.called)
+
+ # check the call sequence for the email
+ args, kwargs = self.mock_client.send_email.call_args
+ self.assertIn("Destination", kwargs)
+ self.assertIn("CcAddresses", kwargs["Destination"])
+
+ self.assertEqual(["testy2@town.com", "mayor@igorville.gov"], kwargs["Destination"]["CcAddresses"])
+
+ # Grab email subject
+ email_subject = kwargs["Content"]["Simple"]["Subject"]["Data"]
+
+ # Check that the subject does NOT contain a prefix for production
+ self.assertNotIn("[MANAGE]", email_subject)
+ self.assertIn("An update was made to", email_subject)
+
+ # Grab email body
+ email_body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"]
+
+ # Check that manage_url is correctly set for production
+ self.assertIn("https://manage.get.gov", email_body)
+
+ @boto3_mocking.patching
+ @override_settings(IS_PRODUCTION=False, BASE_URL="https://getgov-rh.app.cloud.gov")
+ def test_email_non_production_subject_and_url_check(self):
+ """Test sending an email in production that:
+ 1. Does prefix in the email subject (ie [GETGOV-RH])
+ 2. Uses the sandbox url in the email body (ie getgov-rh.app.cloud.gov)"""
+ with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class):
+ send_templated_email(
+ "emails/update_to_approved_domain.txt",
+ "emails/update_to_approved_domain_subject.txt",
+ "doesnotexist@igorville.com",
+ context={"domain": "test", "user": "test", "date": 1, "changes": "test"},
+ bcc_address=None,
+ cc_addresses=["testy2@town.com", "mayor@igorville.gov"],
+ )
+
+ # check that an email was sent
+ self.assertTrue(self.mock_client.send_email.called)
+
+ # check the call sequence for the email
+ args, kwargs = self.mock_client.send_email.call_args
+ self.assertIn("Destination", kwargs)
+ self.assertIn("CcAddresses", kwargs["Destination"])
+ self.assertEqual(["testy2@town.com", "mayor@igorville.gov"], kwargs["Destination"]["CcAddresses"])
+
+ # Grab email subject
+ email_subject = kwargs["Content"]["Simple"]["Subject"]["Data"]
+
+ # Check that the subject DOES contain a prefix of the current sandbox
+ self.assertIn("[GETGOV-RH]", email_subject)
+
+ # Grab email body
+ email_body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"]
+
+ # Check that manage_url is correctly set of the sandbox
+ self.assertIn("https://getgov-rh.app.cloud.gov", email_body)
+
@boto3_mocking.patching
@less_console_noise_decorator
def test_submission_confirmation(self):
diff --git a/src/registrar/tests/test_views_domain.py b/src/registrar/tests/test_views_domain.py
index b84d284d8..1f7e9f262 100644
--- a/src/registrar/tests/test_views_domain.py
+++ b/src/registrar/tests/test_views_domain.py
@@ -477,7 +477,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
self.domain_with_ip.expiration_date = self.expiration_date_one_year_out()
self.domain_with_ip.save()
- @override_flag("domain_renewal", active=True)
def test_expiring_domain_on_detail_page_as_domain_manager(self):
"""If a user is a domain manager and their domain is expiring soon,
user should be able to see the "Renew to maintain access" link domain overview detail box."""
@@ -496,7 +495,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
self.assertNotContains(detail_page, "DNS needed")
self.assertNotContains(detail_page, "Expired")
- @override_flag("domain_renewal", active=True)
@override_flag("organization_feature", active=True)
def test_expiring_domain_on_detail_page_in_org_model_as_a_non_domain_manager(self):
"""In org model: If a user is NOT a domain manager and their domain is expiring soon,
@@ -534,7 +532,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
)
self.assertContains(detail_page, "Contact one of the listed domain managers to renew the domain.")
- @override_flag("domain_renewal", active=True)
@override_flag("organization_feature", active=True)
def test_expiring_domain_on_detail_page_in_org_model_as_a_domain_manager(self):
"""Inorg model: If a user is a domain manager and their domain is expiring soon,
@@ -555,7 +552,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
)
self.assertContains(detail_page, "Renew to maintain access")
- @override_flag("domain_renewal", active=True)
def test_domain_renewal_form_and_sidebar_expiring(self):
"""If a user is a domain manager and their domain is expiring soon,
user should be able to see Renewal Form on the sidebar."""
@@ -584,7 +580,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
self.assertEqual(response.status_code, 200)
self.assertContains(response, f"Renew {self.domain_to_renew.name}")
- @override_flag("domain_renewal", active=True)
def test_domain_renewal_form_and_sidebar_expired(self):
"""If a user is a domain manager and their domain is expired,
user should be able to see Renewal Form on the sidebar."""
@@ -614,7 +609,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
self.assertEqual(response.status_code, 200)
self.assertContains(response, f"Renew {self.domain_to_renew.name}")
- @override_flag("domain_renewal", active=True)
def test_domain_renewal_form_your_contact_info_edit(self):
"""Checking that if a user is a domain manager they can edit the
Your Profile portion of the Renewal Form."""
@@ -634,7 +628,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
self.assertEqual(edit_page.status_code, 200)
self.assertContains(edit_page, "Review the details below and update any required information")
- @override_flag("domain_renewal", active=True)
def test_domain_renewal_form_security_email_edit(self):
"""Checking that if a user is a domain manager they can edit the
Security Email portion of the Renewal Form."""
@@ -657,7 +650,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
self.assertEqual(edit_page.status_code, 200)
self.assertContains(edit_page, "A security contact should be capable of evaluating")
- @override_flag("domain_renewal", active=True)
def test_domain_renewal_form_domain_manager_edit(self):
"""Checking that if a user is a domain manager they can edit the
Domain Manager portion of the Renewal Form."""
@@ -677,7 +669,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
self.assertEqual(edit_page.status_code, 200)
self.assertContains(edit_page, "Domain managers can update all information related to a domain")
- @override_flag("domain_renewal", active=True)
def test_domain_renewal_form_not_expired_or_expiring(self):
"""Checking that if the user's domain is not expired or expiring that user should not be able
to access /renewal and that it should receive a 403."""
@@ -686,7 +677,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
renewal_page = self.client.get(reverse("domain-renewal", kwargs={"pk": self.domain_not_expiring.id}))
self.assertEqual(renewal_page.status_code, 403)
- @override_flag("domain_renewal", active=True)
def test_domain_renewal_form_does_not_appear_if_not_domain_manager(self):
"""If user is not a domain manager and tries to access /renewal, user should receive a 403."""
with patch.object(Domain, "is_expired", self.custom_is_expired_true), patch.object(
@@ -695,7 +685,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
renewal_page = self.client.get(reverse("domain-renewal", kwargs={"pk": self.domain_no_domain_manager.id}))
self.assertEqual(renewal_page.status_code, 403)
- @override_flag("domain_renewal", active=True)
def test_ack_checkbox_not_checked(self):
"""If user don't check the checkbox, user should receive an error message."""
# Grab the renewal URL
@@ -707,7 +696,6 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
error_message = "Check the box if you read and agree to the requirements for operating a .gov domain."
self.assertContains(response, error_message)
- @override_flag("domain_renewal", active=True)
def test_ack_checkbox_checked(self):
"""If user check the checkbox and submits the form,
user should be redirected Domain Over page with an updated by 1 year expiration date"""
@@ -2992,26 +2980,15 @@ class TestDomainRenewal(TestWithUser):
pass
super().tearDown()
- # Remove test_without_domain_renewal_flag when domain renewal is released as a feature
@less_console_noise_decorator
- @override_flag("domain_renewal", active=False)
- def test_without_domain_renewal_flag(self):
- self.client.force_login(self.user)
- domains_page = self.client.get("/")
- self.assertNotContains(domains_page, "will expire soon")
- self.assertNotContains(domains_page, "Expiring soon")
-
- @less_console_noise_decorator
- @override_flag("domain_renewal", active=True)
- def test_domain_renewal_flag_single_domain(self):
+ def test_domain_with_single_domain(self):
self.client.force_login(self.user)
domains_page = self.client.get("/")
self.assertContains(domains_page, "One domain will expire soon")
self.assertContains(domains_page, "Expiring soon")
@less_console_noise_decorator
- @override_flag("domain_renewal", active=True)
- def test_with_domain_renewal_flag_mulitple_domains(self):
+ def test_with_mulitple_domains(self):
today = datetime.now()
expiring_date = (today + timedelta(days=30)).strftime("%Y-%m-%d")
self.domain_with_another_expiring, _ = Domain.objects.get_or_create(
@@ -3027,8 +3004,7 @@ class TestDomainRenewal(TestWithUser):
self.assertContains(domains_page, "Expiring soon")
@less_console_noise_decorator
- @override_flag("domain_renewal", active=True)
- def test_with_domain_renewal_flag_no_expiring_domains(self):
+ def test_with_no_expiring_domains(self):
UserDomainRole.objects.filter(user=self.user, domain=self.domain_with_expired_date).delete()
UserDomainRole.objects.filter(user=self.user, domain=self.domain_with_expiring_soon_date).delete()
self.client.force_login(self.user)
@@ -3036,18 +3012,16 @@ class TestDomainRenewal(TestWithUser):
self.assertNotContains(domains_page, "will expire soon")
@less_console_noise_decorator
- @override_flag("domain_renewal", active=True)
@override_flag("organization_feature", active=True)
- def test_domain_renewal_flag_single_domain_w_org_feature_flag(self):
+ def test_single_domain_w_org_feature_flag(self):
self.client.force_login(self.user)
domains_page = self.client.get("/")
self.assertContains(domains_page, "One domain will expire soon")
self.assertContains(domains_page, "Expiring soon")
@less_console_noise_decorator
- @override_flag("domain_renewal", active=True)
@override_flag("organization_feature", active=True)
- def test_with_domain_renewal_flag_mulitple_domains_w_org_feature_flag(self):
+ def test_with_mulitple_domains_w_org_feature_flag(self):
today = datetime.now()
expiring_date = (today + timedelta(days=31)).strftime("%Y-%m-%d")
self.domain_with_another_expiring_org_model, _ = Domain.objects.get_or_create(
@@ -3063,9 +3037,8 @@ class TestDomainRenewal(TestWithUser):
self.assertContains(domains_page, "Expiring soon")
@less_console_noise_decorator
- @override_flag("domain_renewal", active=True)
@override_flag("organization_feature", active=True)
- def test_with_domain_renewal_flag_no_expiring_domains_w_org_feature_flag(self):
+ def test_no_expiring_domains_w_org_feature_flag(self):
UserDomainRole.objects.filter(user=self.user, domain=self.domain_with_expired_date).delete()
UserDomainRole.objects.filter(user=self.user, domain=self.domain_with_expiring_soon_date).delete()
self.client.force_login(self.user)
diff --git a/src/registrar/utility/email.py b/src/registrar/utility/email.py
index 40601cdc7..94e87a96b 100644
--- a/src/registrar/utility/email.py
+++ b/src/registrar/utility/email.py
@@ -3,6 +3,7 @@
import boto3
import logging
import textwrap
+import re
from datetime import datetime
from django.apps import apps
from django.conf import settings
@@ -48,6 +49,21 @@ def send_templated_email( # noqa
No valid recipient addresses are provided
"""
+ if context is None:
+ context = {}
+
+ env_base_url = settings.BASE_URL
+ # The regular expression is to get both http (localhost) and https (everything else)
+ env_name = re.sub(r"^https?://", "", env_base_url).split(".")[0]
+ # If NOT in prod, add env to the subject line
+ # IE adds [GETGOV-RH] if we are in the -RH sandbox
+ prefix = f"[{env_name.upper()}] " if not settings.IS_PRODUCTION else ""
+ # If NOT in prod, update instances of "manage.get.gov" links to point to
+ # current environment, ie "getgov-rh.app.cloud.gov"
+ manage_url = env_base_url if not settings.IS_PRODUCTION else "https://manage.get.gov"
+
+ context["manage_url"] = manage_url
+
# by default assume we can send to all addresses (prod has no whitelist)
sendable_cc_addresses = cc_addresses
@@ -70,8 +86,10 @@ def send_templated_email( # noqa
if email_body:
email_body.strip().lstrip("\n")
+ # Update the subject to have prefix here versus every email
subject_template = get_template(subject_template_name)
subject = subject_template.render(context=context)
+ subject = f"{prefix}{subject}"
try:
ses_client = boto3.client(
diff --git a/src/registrar/views/domain.py b/src/registrar/views/domain.py
index 089bbe1a9..72826e570 100644
--- a/src/registrar/views/domain.py
+++ b/src/registrar/views/domain.py
@@ -366,7 +366,7 @@ class DomainRenewalView(DomainBaseView):
return HttpResponseRedirect(reverse("domain", kwargs={"pk": pk}))
# if not valid, render the template with error messages
- # passing editable, has_domain_renewal_flag, and is_editable for re-render
+ # passing editable and is_editable for re-render
return render(
request,
"domain_renewal.html",
@@ -374,7 +374,6 @@ class DomainRenewalView(DomainBaseView):
"domain": domain,
"form": form,
"is_editable": True,
- "has_domain_renewal_flag": True,
"is_domain_manager": True,
},
)