-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#2370: email domain managers on domain invitation [MEOWARD] #3351
Open
dave-kennedy-ecs
wants to merge
9
commits into
main
Choose a base branch
from
meoward/2370-email-domain-managers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+502
−24
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c0f5dca
add email to domain managers on domain invitation
dave-kennedy-ecs ca136c6
updated error message when EmailSendingError
dave-kennedy-ecs 2876387
informational alerts on change forms
rachidatecs 9b13b1b
pull from upstream
rachidatecs cb84940
template tests
rachidatecs 4a0dc40
fix mock_send_domain_email unit tests
rachidatecs c10a773
tests and lint
dave-kennedy-ecs 13c9e1c
lint
dave-kennedy-ecs 3420cc3
more linter
dave-kennedy-ecs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/registrar/templates/django/admin/domain_invitation_change_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% extends 'django/admin/email_clipboard_change_form.html' %} | ||
{% load custom_filters %} | ||
{% load i18n static %} | ||
|
||
{% block content_subtitle %} | ||
<div class="usa-alert usa-alert--info usa-alert--slim"> | ||
<div class="usa-alert__body margin-left-1 maxw-none"> | ||
<p class="usa-alert__text maxw-none"> | ||
If you add someone to a domain here, it will trigger emails to the invitee and all managers of the domain when you click "save." If you don't want to trigger those emails, use the <a class="usa-link" href="{% url 'admin:registrar_userdomainrole_changelist' %}">User domain roles permissions table</a> instead. | ||
</p> | ||
</div> | ||
</div> | ||
{{ block.super }} | ||
{% endblock %} |
14 changes: 14 additions & 0 deletions
14
src/registrar/templates/django/admin/user_domain_role_change_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% extends 'django/admin/email_clipboard_change_form.html' %} | ||
{% load custom_filters %} | ||
{% load i18n static %} | ||
|
||
{% block content_subtitle %} | ||
<div class="usa-alert usa-alert--info usa-alert--slim"> | ||
<div class="usa-alert__body margin-left-1 maxw-none"> | ||
<p class="usa-alert__text maxw-none"> | ||
If you add someone to a domain here, it will not trigger any emails. To trigger emails, use the <a class="usa-link" href="{% url 'admin:registrar_domaininvitation_changelist' %}">User Domain Role invitations table</a> instead. | ||
</p> | ||
</div> | ||
</div> | ||
{{ block.super }} | ||
{% endblock %} |
43 changes: 43 additions & 0 deletions
43
src/registrar/templates/emails/domain_manager_notification.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #} | ||
Hi,{% if domain_manager and domain_manager.first_name %} {{ domain_manager.first_name }}.{% endif %} | ||
|
||
A domain manager was invited to {{ domain.name }}. | ||
DOMAIN: {{ domain.name }} | ||
INVITED BY: {{ requestor_email }} | ||
INVITED ON: {{date}} | ||
MANAGER INVITED: {{ invited_email_address }} | ||
|
||
|
||
---------------------------------------------------------------- | ||
|
||
|
||
NEXT STEPS | ||
|
||
The person who received the invitation will become a domain manager once they log in to the | ||
.gov registrar. They'll need to access the registrar using a Login.gov account that's | ||
associated with the invited email address. | ||
|
||
If you need to cancel this invitation or remove the domain manager (because they've already | ||
logged in), you can do that by going to this domain in the .gov registrar <https://manage.get.gov/>. | ||
|
||
|
||
WHY DID YOU RECEIVE THIS EMAIL? | ||
|
||
You’re listed as a domain manager for {{ domain.name }}, so you’ll receive a notification whenever | ||
someone is invited to manage that domain. | ||
|
||
If you have questions or concerns, reach out to the person who sent the invitation or reply to this email. | ||
|
||
|
||
THANK YOU | ||
.Gov helps the public identify official, trusted information. Thank you for using a .gov domain. | ||
|
||
---------------------------------------------------------------- | ||
|
||
The .gov team | ||
Contact us: <https://get.gov/contact/> | ||
Learn about .gov <https://get.gov> | ||
|
||
The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency | ||
(CISA) <https://cisa.gov/> | ||
{% endautoescape %} |
1 change: 1 addition & 0 deletions
1
src/registrar/templates/emails/domain_manager_notification_subject.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A domain manager was invited to {{ domain.name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,6 +166,29 @@ def test_has_model_description(self): | |
) | ||
self.assertContains(response, "Show more") | ||
|
||
@less_console_noise_decorator | ||
def test_has_change_form_description(self): | ||
"""Tests if this model has a model description on the change form view""" | ||
self.client.force_login(self.superuser) | ||
|
||
domain, _ = Domain.objects.get_or_create(name="systemofadown.com") | ||
|
||
domain_invitation, _ = DomainInvitation.objects.get_or_create(email="[email protected]", domain=domain) | ||
|
||
response = self.client.get( | ||
"/admin/registrar/domaininvitation/{}/change/".format(domain_invitation.pk), | ||
follow=True, | ||
) | ||
|
||
# Make sure that the page is loaded correctly | ||
self.assertEqual(response.status_code, 200) | ||
|
||
# Test for a description snippet | ||
self.assertContains( | ||
response, | ||
"If you add someone to a domain here, it will trigger emails to the invitee and all managers of the domain", | ||
) | ||
|
||
@less_console_noise_decorator | ||
def test_get_filters(self): | ||
"""Ensures that our filters are displaying correctly""" | ||
|
@@ -1957,6 +1980,31 @@ def test_has_model_description(self): | |
) | ||
self.assertContains(response, "Show more") | ||
|
||
@less_console_noise_decorator | ||
def test_has_change_form_description(self): | ||
"""Tests if this model has a model description on the change form view""" | ||
self.client.force_login(self.superuser) | ||
|
||
domain, _ = Domain.objects.get_or_create(name="systemofadown.com") | ||
|
||
user_domain_role, _ = UserDomainRole.objects.get_or_create( | ||
user=self.superuser, domain=domain, role=[UserDomainRole.Roles.MANAGER] | ||
) | ||
|
||
response = self.client.get( | ||
"/admin/registrar/userdomainrole/{}/change/".format(user_domain_role.pk), | ||
follow=True, | ||
) | ||
|
||
# Make sure that the page is loaded correctly | ||
self.assertEqual(response.status_code, 200) | ||
|
||
# Test for a description snippet | ||
self.assertContains( | ||
response, | ||
"If you add someone to a domain here, it will not trigger any emails.", | ||
) | ||
|
||
def test_domain_sortable(self): | ||
"""Tests if the UserDomainrole sorts by domain correctly""" | ||
with less_console_noise(): | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Katherine-Osos not important for now, but when we get to multiple portfolios, we may want to consider having the org name on notifications.
(Devs ignore this comment, n/a for your ticket)