simplified data sent to transition domain invitation email templates

This commit is contained in:
David Kennedy 2023-09-20 08:40:29 -04:00
parent b647750af7
commit 3243399d26
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
3 changed files with 6 additions and 15 deletions

View file

@ -523,9 +523,6 @@ STATIC_URL = "public/"
# {% public_site_url subdir/path %} template tag # {% public_site_url subdir/path %} template tag
GETGOV_PUBLIC_SITE_URL = env_getgov_public_site_url GETGOV_PUBLIC_SITE_URL = env_getgov_public_site_url
# Base URL of application
BASE_URL = env_base_url
# endregion # endregion
# region: Registry----------------------------------------------------------### # region: Registry----------------------------------------------------------###

View file

@ -3,9 +3,7 @@
import logging import logging
import copy import copy
from django.conf import settings
from django.core.management import BaseCommand from django.core.management import BaseCommand
from django.urls import reverse
from registrar.models import TransitionDomain, Domain from registrar.models import TransitionDomain, Domain
from ...utility.email import send_templated_email, EmailSendingError from ...utility.email import send_templated_email, EmailSendingError
from typing import List from typing import List
@ -89,11 +87,7 @@ class Command(BaseCommand):
email_context["domains"] = [] email_context["domains"] = []
email_context["email"] = transition_domain.username email_context["email"] = transition_domain.username
email_context["domains"].append( email_context["domains"].append(
{ transition_domain.domain_name
"name": transition_domain.domain_name,
"url": settings.BASE_URL
+ reverse("domain", kwargs={"pk": domain.id}),
}
) )
except Exception as err: except Exception as err:
# error condition if domain not in database # error condition if domain not in database
@ -128,12 +122,12 @@ class Command(BaseCommand):
# success message is logged # success message is logged
logger.info( logger.info(
f"email sent successfully to {email_data['email']} for " f"email sent successfully to {email_data['email']} for "
f"{[domain['name'] for domain in email_data['domains']]}" f"{[domain for domain in email_data['domains']]}"
) )
except EmailSendingError as err: except EmailSendingError as err:
logger.error( logger.error(
f"email did not send successfully to {email_data['email']} " f"email did not send successfully to {email_data['email']} "
f"for {[domain['name'] for domain in email_data['domains']]}" f"for {[domain for domain in email_data['domains']]}"
f": {err}" f": {err}"
) )
# if email failed to send, set error in domains_with_errors for each # if email failed to send, set error in domains_with_errors for each

View file

@ -1,7 +1,7 @@
{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #} {% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #}
Hi. Hi.
You have been added as a manager on {% if domains|length > 1 %}multiple domains (listed below){% else %}{{ domains.0.name }}{% endif %}. You have been added as a manager on {% if domains|length > 1 %}multiple domains (listed below){% else %}{{ domains.0 }}{% endif %}.
YOU NEED A LOGIN.GOV ACCOUNT YOU NEED A LOGIN.GOV ACCOUNT
Youll need a Login.gov account to manage your .gov domain{% if domains|length > 1 %}s{% endif %}. 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/>. Youll need a Login.gov account to manage your .gov domain{% if domains|length > 1 %}s{% endif %}. 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,11 +10,11 @@ DOMAIN MANAGEMENT
As a .gov domain manager you can add or update information about your domain{% if domains|length > 1 %}s{% endif %}. Youll also serve as a contact for your .gov domain{% if domains|length > 1 %}s{% endif %}. Please keep your contact information updated. Learn more about domain management <https://get.gov/help/>. As a .gov domain manager you can add or update information about your domain{% if domains|length > 1 %}s{% endif %}. Youll also serve as a contact for your .gov domain{% if domains|length > 1 %}s{% endif %}. Please keep your contact information updated. Learn more about domain management <https://get.gov/help/>.
{% if domains|length > 1 %} {% if domains|length > 1 %}
DOMAINS DOMAINS
{% for domain in domains %} {{ domain.name }} {% for domain in domains %} {{ domain }}
{% endfor %}{% else %} {% endfor %}{% else %}
{% endif %} {% endif %}
SOMETHING WRONG? SOMETHING WRONG?
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>. If youre not affiliated with {{ domain }} or think you received this message in error, contact the .gov team <https://get.gov/help/#contact-us>.
THANK YOU THANK YOU