#300 Extend mail templates

* extends all relevant mail templates such that municipals of an entry will be shown in the mail
This commit is contained in:
2023-02-23 10:17:45 +01:00
parent e1259b276c
commit bf41559c56
23 changed files with 383 additions and 158 deletions

View File

@@ -45,12 +45,14 @@ class Mailer:
auth_password=self.auth_password
)
def send_mail_shared_access_removed(self, obj_identifier, obj_title, user):
def send_mail_shared_access_removed(self, obj_identifier, obj_title, user, municipals_names):
""" Send a mail if user has no access to the object anymore
Args:
obj_identifier (str): The object identifier
obj_title (str): The object title
user (User): Related user
municipals_names (iterable): List of municipals of the entry
Returns:
@@ -59,6 +61,7 @@ class Mailer:
"user": user,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/sharing/shared_access_removed.html", context)
@@ -69,11 +72,14 @@ class Mailer:
msg
)
def send_mail_shared_access_given(self, obj_identifier, obj_title, user):
def send_mail_shared_access_given(self, obj_identifier, obj_title, user, municipals_names):
""" Send a mail if user just got access to the object
Args:
obj_identifier (str): The object identifier
obj_title (str): The object title
user (User): The related user
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -82,6 +88,7 @@ class Mailer:
"user": user,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/sharing/shared_access_given.html", context)
@@ -92,7 +99,7 @@ class Mailer:
msg
)
def send_mail_shared_access_given_team(self, obj_identifier, obj_title, team, users_to_notify):
def send_mail_shared_access_given_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
""" Send a mail if a team just got access to the object
Args:
@@ -100,6 +107,7 @@ class Mailer:
obj_title (str): Title of the main object
team (Team): Team to be notified
users_to_notify (QueryDict): Contains the team users which should be notified
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -108,6 +116,7 @@ class Mailer:
"team": team,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/sharing/shared_access_given_team.html", context)
@@ -118,7 +127,7 @@ class Mailer:
msg
)
def send_mail_shared_access_removed_team(self, obj_identifier, obj_title, team, users_to_notify):
def send_mail_shared_access_removed_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
""" Send a mail if a team just lost access to the object
Args:
@@ -126,6 +135,7 @@ class Mailer:
obj_title (str): Title of the main object
team (Team): Team to be notified
users_to_notify (QueryDict): Contains the team users which should be notified
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -134,6 +144,7 @@ class Mailer:
"team": team,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/sharing/shared_access_removed_team.html", context)
@@ -144,7 +155,7 @@ class Mailer:
msg
)
def send_mail_shared_data_unrecorded_team(self, obj_identifier, obj_title, team, users_to_notify):
def send_mail_shared_data_unrecorded_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
""" Send a mail if data has just been unrecorded
Args:
@@ -152,6 +163,7 @@ class Mailer:
obj_title (str): Title of the main object
team (Team): Team to be notified
users_to_notify (QueryDict): Contains the team users which should be notified
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -160,6 +172,7 @@ class Mailer:
"team": team,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/recording/shared_data_unrecorded_team.html", context)
@@ -170,7 +183,7 @@ class Mailer:
msg
)
def send_mail_shared_data_recorded_team(self, obj_identifier, obj_title, team, users_to_notify):
def send_mail_shared_data_recorded_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
""" Send a mail if data has just been recorded
Args:
@@ -178,6 +191,7 @@ class Mailer:
obj_title (str): Title of the main object
team (Team): Team to be notified
users_to_notify (QueryDict): Contains the team users which should be notified
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -186,6 +200,7 @@ class Mailer:
"team": team,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/recording/shared_data_recorded_team.html", context)
@@ -196,7 +211,7 @@ class Mailer:
msg
)
def send_mail_shared_data_checked_team(self, obj_identifier, obj_title, team, users_to_notify):
def send_mail_shared_data_checked_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
""" Send a mail if data has just been checked
Args:
@@ -204,6 +219,7 @@ class Mailer:
obj_title (str): Title of the main object
team (Team): Team to be notified
users_to_notify (QueryDict): Contains the team users which should be notified
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -212,6 +228,7 @@ class Mailer:
"team": team,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/checking/shared_data_checked_team.html", context)
@@ -249,11 +266,15 @@ class Mailer:
msg
)
def send_mail_shared_data_deleted_team(self, obj_identifier, obj_title, team, users_to_notify):
def send_mail_shared_data_deleted_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
""" Send a mail if data has just been deleted
Args:
obj_identifier (str): The object identifier
obj_title (str): The object title
team (Team): The related team
users_to_notify (QuerySet): Contains team users who want to be notified
municipals_names (iterable): List of municipals for the entry
Returns:
@@ -262,6 +283,7 @@ class Mailer:
"team": team,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/deleting/shared_data_deleted_team.html", context)
@@ -272,11 +294,14 @@ class Mailer:
msg
)
def send_mail_shared_data_recorded(self, obj_identifier, obj_title, user):
def send_mail_shared_data_recorded(self, obj_identifier, obj_title, user, municipals_names):
""" Send a mail if the user's shared data has just been unrecorded
Args:
obj_identifier (str): The object identifier
obj_title (str): The object title
user (User): The related user
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -285,6 +310,7 @@ class Mailer:
"user": user,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/recording/shared_data_recorded.html", context)
@@ -295,11 +321,14 @@ class Mailer:
msg
)
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title, user):
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title, user, municipals_names):
""" Send a mail if the user's shared data has just been unrecorded
Args:
obj_identifier (str): The object identifier
obj_title (str): The object title
user (User): The related user
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -308,6 +337,7 @@ class Mailer:
"user": user,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/recording/shared_data_unrecorded.html", context)
@@ -318,11 +348,14 @@ class Mailer:
msg
)
def send_mail_shared_data_deleted(self, obj_identifier, obj_title, user):
def send_mail_shared_data_deleted(self, obj_identifier, obj_title, user, municipals_names):
""" Send a mail if shared data has just been deleted
Args:
obj_identifier (str): The object identifier
obj_title (str): The object title
user (User): The related user
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -331,6 +364,7 @@ class Mailer:
"user": user,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/deleting/shared_data_deleted.html", context)
@@ -341,11 +375,14 @@ class Mailer:
msg
)
def send_mail_shared_data_checked(self, obj_identifier, obj_title, user):
def send_mail_shared_data_checked(self, obj_identifier, obj_title, user, municipals_names):
""" Send a mail if shared data just has been checked
Args:
obj_identifier (str): The object identifier
obj_title (str): The object title
user (User): The related user
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -354,6 +391,7 @@ class Mailer:
"user": user,
"obj_identifier": obj_identifier,
"obj_title": obj_title,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/checking/shared_data_checked.html", context)
@@ -413,12 +451,13 @@ class Mailer:
msg
)
def send_mail_resubmission(self, obj_identifier, resubmission):
def send_mail_resubmission(self, obj_identifier, resubmission, municipals_names):
""" Send a resubmission mail for a user
Args:
obj_identifier (str): The (resubmitted) object's identifier
resubmission (Resubmission): The resubmission
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -426,6 +465,7 @@ class Mailer:
context = {
"obj_identifier": obj_identifier,
"resubmission": resubmission,
"municipals_names": municipals_names,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/resubmission/resubmission.html", context)