#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

@@ -60,12 +60,13 @@ class User(AbstractUser):
name=ETS_GROUP
).exists()
def send_mail_shared_access_removed(self, obj_identifier, obj_title):
def send_mail_shared_access_removed(self, obj_identifier, obj_title, municipals_names):
""" Sends a mail to the user in case of removed shared access
Args:
obj_identifier ():
obj_title ():
municipals_names ():
Returns:
@@ -73,13 +74,15 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_REMOVED)
if notification_set:
mailer = Mailer()
mailer.send_mail_shared_access_removed(obj_identifier, obj_title, self)
mailer.send_mail_shared_access_removed(obj_identifier, obj_title, self, municipals_names)
def send_mail_shared_access_given(self, obj_identifier, obj_title):
def send_mail_shared_access_given(self, obj_identifier, obj_title, municipals_names):
""" Sends a mail to the user in case of given shared access
Args:
obj_identifier ():
obj_identifier (str): The entry identifier
obj_title (str): The entry title
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -87,13 +90,15 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_GAINED)
if notification_set:
mailer = Mailer()
mailer.send_mail_shared_access_given(obj_identifier, obj_title, self)
mailer.send_mail_shared_access_given(obj_identifier, obj_title, self, municipals_names)
def send_mail_shared_data_recorded(self, obj_identifier, obj_title):
def send_mail_shared_data_recorded(self, obj_identifier, obj_title, municipals_names):
""" Sends a mail to the user in case of shared data has been recorded
Args:
obj_identifier ():
obj_identifier (str): The entry identifier
obj_title (str): The entry title
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -101,13 +106,15 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED)
if notification_set:
mailer = Mailer()
mailer.send_mail_shared_data_recorded(obj_identifier, obj_title, self)
mailer.send_mail_shared_data_recorded(obj_identifier, obj_title, self, municipals_names)
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title):
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title, municipals_names):
""" Sends a mail to the user in case of shared data has been unrecorded
Args:
obj_identifier ():
obj_identifier (str): The entry identifier
obj_title (str): The entry title
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -115,13 +122,15 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED)
if notification_set:
mailer = Mailer()
mailer.send_mail_shared_data_unrecorded(obj_identifier, obj_title, self)
mailer.send_mail_shared_data_unrecorded(obj_identifier, obj_title, self, municipals_names)
def send_mail_shared_data_deleted(self, obj_identifier, obj_title):
def send_mail_shared_data_deleted(self, obj_identifier, obj_title, municipals_names):
""" Sends a mail to the user in case of shared data has been deleted
Args:
obj_identifier ():
obj_identifier (str): The entry identifier
obj_title (str): The entry title
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -129,13 +138,15 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_DELETED)
if notification_set:
mailer = Mailer()
mailer.send_mail_shared_data_deleted(obj_identifier, obj_title, self)
mailer.send_mail_shared_data_deleted(obj_identifier, obj_title, self, municipals_names)
def send_mail_shared_data_checked(self, obj_identifier, obj_title):
def send_mail_shared_data_checked(self, obj_identifier, obj_title, municipals_names):
""" Sends a mail to the user in case of shared data has been deleted
Args:
obj_identifier ():
obj_identifier (str): The entry identifier
obj_title (str): The entry title
municipals_names (iterable): List of municipals for this entry
Returns:
@@ -143,7 +154,7 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_CHECKED)
if notification_set:
mailer = Mailer()
mailer.send_mail_shared_data_checked(obj_identifier, obj_title, self)
mailer.send_mail_shared_data_checked(obj_identifier, obj_title, self, municipals_names)
def send_mail_deduction_changed(self, obj_identifier, obj_title, data_changes):
""" Sends a mail to the user in case of a changed deduction