Fix creator reference and wording on invitation

This commit is contained in:
Rebecca Hsieh 2023-09-15 10:28:54 -07:00
parent bbe030ea36
commit fc1792fc3c
No known key found for this signature in database
GPG key ID: 644527A2F375A379
4 changed files with 30 additions and 5 deletions

View file

@ -1,7 +1,7 @@
{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #}
Hi.
{{ first_name }} has added you as a manager on {{ domain.name }}.
{{ full_name }} has added you as a manager on {{ domain.name }}.
YOU NEED A LOGIN.GOV ACCOUNT
Youll need a Login.gov account to manage your .gov domain. Login.gov provides a simple and secure process for signing into many government services with one account. If you dont already have one, follow these steps to create your Login.gov account <https://login.gov/help/get-started/create-your-account/>.
@ -10,7 +10,7 @@ DOMAIN MANAGEMENT
As a .gov domain manager you can add or update information about your domain. Youll also serve as a contact for your .gov domain. Please keep your contact information updated. Learn more about domain management <https://get.gov/help/>.
SOMETHING WRONG?
If youre not affiliated with $domain.gov or think you received this message in error, contact the .gov team <https://get.gov/help/#contact-us>.
If youre not affiliated with {{ domain.name }} or think you received this message in error, contact the .gov team <https://get.gov/help/#contact-us>.
THANK YOU

View file

@ -457,6 +457,7 @@ def completed_application(
has_anything_else=True,
status=DomainApplication.STARTED,
user=False,
name="city.gov",
):
"""A completed domain application."""
if not user:
@ -468,7 +469,7 @@ def completed_application(
email="testy@town.com",
phone="(555) 555 5555",
)
domain, _ = DraftDomain.objects.get_or_create(name="city.gov")
domain, _ = DraftDomain.objects.get_or_create(name=name)
alt, _ = Website.objects.get_or_create(website="city1.gov")
current, _ = Website.objects.get_or_create(website="city.com")
you, _ = Contact.objects.get_or_create(

View file

@ -1079,6 +1079,7 @@ class TestWithDomainPermissions(TestWithUser):
self.domain_information.delete()
if hasattr(self.domain, "contacts"):
self.domain.contacts.all().delete()
DomainApplication.objects.all().delete()
self.domain.delete()
self.role.delete()
except ValueError: # pass if already deleted
@ -1197,6 +1198,13 @@ class TestDomainDetail(TestWithDomainPermissions, WebTest):
EMAIL = "mayor@igorville.gov"
User.objects.filter(email=EMAIL).delete()
# Create an application
application = completed_application(
status=DomainApplication.APPROVED, user=self.user, name=self.domain.name
)
application.approved_domain = self.domain
application.save()
add_page = self.app.get(
reverse("domain-users-add", kwargs={"pk": self.domain.id})
)
@ -1218,6 +1226,13 @@ class TestDomainDetail(TestWithDomainPermissions, WebTest):
EMAIL = "mayor@igorville.gov"
User.objects.filter(email=EMAIL).delete()
# Create an application
application = completed_application(
status=DomainApplication.APPROVED, user=self.user, name=self.domain.name
)
application.approved_domain = self.domain
application.save()
mock_client = MagicMock()
mock_client_instance = mock_client.return_value
with boto3_mocking.clients.handler_for("sesv2", mock_client):
@ -1270,6 +1285,14 @@ class TestDomainDetail(TestWithDomainPermissions, WebTest):
add_page = self.app.get(
reverse("domain-users-add", kwargs={"pk": self.domain.id})
)
# Create an application
application = completed_application(
status=DomainApplication.APPROVED, user=self.user, name=self.domain.name
)
application.approved_domain = self.domain
application.save()
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
add_page.form["email"] = EMAIL
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)

View file

@ -336,7 +336,8 @@ class DomainAddUserView(DomainPermissionView, FormMixin):
)
else:
# created a new invitation in the database, so send an email
dapplication = DomainApplication.objects.filter(approved_domain__name=self.object.name)
dapplication = DomainApplication.objects.filter(approved_domain=self.object)
try:
send_templated_email(
"emails/domain_invitation.txt",
@ -345,7 +346,7 @@ class DomainAddUserView(DomainPermissionView, FormMixin):
context={
"domain_url": self._domain_abs_url(),
"domain": self.object,
"first_name": dapplication.first().creator,
"full_name": dapplication.first().creator,
},
)
except EmailSendingError: