Skip to content

Commit

Permalink
revised email template
Browse files Browse the repository at this point in the history
  • Loading branch information
raftmsohani committed Nov 1, 2024
1 parent 2963c1f commit 72516dc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions tdrs-backend/tdpservice/email/helpers/admin_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def email_admin_deactivated_user(user):
logger_context=logger_context
)

def email_system_owner_system_admin_role_change(user):
def email_system_owner_system_admin_role_change(user, action):
"""Send an email to the System Owner when a user is assigned or removed from the System Admin role."""
from tdpservice.users.models import User
from tdpservice.email.email_enums import EmailType
from tdpservice.email.email import automated_email, log
from tdpservice.email.tasks import get_ofa_admin_user_emails, get_system_owner_email
from tdpservice.email.tasks import get_system_owner_email
recipient_email = get_system_owner_email()
logger_context = {
'user_id': user.id,
Expand All @@ -53,6 +53,7 @@ def email_system_owner_system_admin_role_change(user):
subject = 'TDP User Role Change: System Admin'
context = {
'user': user,
'action': action,
}

log(f"Preparing email to System Owner for System Admin role change for user {user.username}", logger_context=logger_context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Body copy -->
<p style="color: #000000;">

<p>The following user account for the TANF Data Portal (TDP) has been deactivated.</p>
<p>The following Admin User account for the TANF Data Portal (TDP) has been {{ action }}.</p>

<p>Account Information:</p>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/users/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def user_group_changed(sender, instance, action, pk_set, **kwargs):
group_change_list = [pk for pk in pk_set]
if ADMIN_GROUP_PK in group_change_list and action == ACTIONS['PRE_ADD']:
# EMAIL ADMIN GROUP ADDED to OFA ADMIN
email_system_owner_system_admin_role_change(instance)
email_system_owner_system_admin_role_change(instance, "added")
elif ADMIN_GROUP_PK in group_change_list and action == ACTIONS['PRE_REMOVE']:
# EMAIL ADMIN GROUP REMOVED from OFA ADMIN
email_system_owner_system_admin_role_change(instance)
email_system_owner_system_admin_role_change(instance, "removed")

0 comments on commit 72516dc

Please sign in to comment.