From 3243399d265a171c091d9db0f376d39a7040f55c Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Wed, 20 Sep 2023 08:40:29 -0400 Subject: [PATCH] simplified data sent to transition domain invitation email templates --- src/registrar/config/settings.py | 3 --- .../management/commands/send_domain_invitations.py | 12 +++--------- .../emails/transition_domain_invitation.txt | 6 +++--- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py index 933d95828..e272e6622 100644 --- a/src/registrar/config/settings.py +++ b/src/registrar/config/settings.py @@ -523,9 +523,6 @@ STATIC_URL = "public/" # {% public_site_url subdir/path %} template tag GETGOV_PUBLIC_SITE_URL = env_getgov_public_site_url -# Base URL of application -BASE_URL = env_base_url - # endregion # region: Registry----------------------------------------------------------### diff --git a/src/registrar/management/commands/send_domain_invitations.py b/src/registrar/management/commands/send_domain_invitations.py index 4c595a2b5..fea2139c8 100644 --- a/src/registrar/management/commands/send_domain_invitations.py +++ b/src/registrar/management/commands/send_domain_invitations.py @@ -3,9 +3,7 @@ import logging import copy -from django.conf import settings from django.core.management import BaseCommand -from django.urls import reverse from registrar.models import TransitionDomain, Domain from ...utility.email import send_templated_email, EmailSendingError from typing import List @@ -89,11 +87,7 @@ class Command(BaseCommand): email_context["domains"] = [] email_context["email"] = transition_domain.username email_context["domains"].append( - { - "name": transition_domain.domain_name, - "url": settings.BASE_URL - + reverse("domain", kwargs={"pk": domain.id}), - } + transition_domain.domain_name ) except Exception as err: # error condition if domain not in database @@ -128,12 +122,12 @@ class Command(BaseCommand): # success message is logged logger.info( 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: logger.error( 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}" ) # if email failed to send, set error in domains_with_errors for each diff --git a/src/registrar/templates/emails/transition_domain_invitation.txt b/src/registrar/templates/emails/transition_domain_invitation.txt index 146db9743..42013dbf7 100644 --- a/src/registrar/templates/emails/transition_domain_invitation.txt +++ b/src/registrar/templates/emails/transition_domain_invitation.txt @@ -1,7 +1,7 @@ {% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #} 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’ll 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 don’t already have one, follow these steps to create your Login.gov 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 %}. You’ll 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 . {% if domains|length > 1 %} DOMAINS -{% for domain in domains %} {{ domain.name }} +{% for domain in domains %} {{ domain }} {% endfor %}{% else %} {% endif %} SOMETHING WRONG? -If you’re not affiliated with {{ domain.name }} or think you received this message in error, contact the .gov team . +If you’re not affiliated with {{ domain }} or think you received this message in error, contact the .gov team . THANK YOU