Object mailing restructred
* restructures object info mail sending
This commit is contained in:
@@ -31,12 +31,11 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
self.deleted = delete_action
|
||||
self.save()
|
||||
|
||||
def send_mail_shared_access_given_team(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_access_given_team(self, obj, municipals_names):
|
||||
""" Sends a mail to the team members in case of given shared access
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (str): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -46,14 +45,13 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_GAINED.value]
|
||||
)
|
||||
mailer.send_mail_shared_access_given_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_access_given_team(obj, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_shared_access_removed(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_access_removed(self, obj, municipals_names):
|
||||
""" Sends a mail to the team members in case of removed shared access
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -63,14 +61,13 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_REMOVED.value]
|
||||
)
|
||||
mailer.send_mail_shared_access_removed_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_access_removed_team(obj, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_data_unrecorded(self, obj, municipals_names):
|
||||
""" Sends a mail to the team members in case of unrecorded data
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -80,14 +77,13 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED.value]
|
||||
)
|
||||
mailer.send_mail_shared_data_unrecorded_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_data_unrecorded_team(obj, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_shared_data_recorded(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_data_recorded(self, obj, municipals_names):
|
||||
""" Sends a mail to the team members in case of unrecorded data
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -97,14 +93,13 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED.value]
|
||||
)
|
||||
mailer.send_mail_shared_data_recorded_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_data_recorded_team(obj, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_shared_data_checked(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_data_checked(self, obj, municipals_names):
|
||||
""" Sends a mail to the team members in case of checked data
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -114,14 +109,13 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_DATA_CHECKED.value]
|
||||
)
|
||||
mailer.send_mail_shared_data_checked_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_data_checked_team(obj, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_deduction_changed(self, obj_identifier, obj_title, data_changes):
|
||||
def send_mail_deduction_changed(self, obj, data_changes):
|
||||
""" Sends a mail to the team members in case of changed deduction values
|
||||
|
||||
Args:
|
||||
obj_identifier (str): Identifier of the main object
|
||||
obj_title (str): Title of the main object
|
||||
obj (): The main object
|
||||
data_changes (dict): Contains the old|new changes of the deduction changes
|
||||
|
||||
Returns:
|
||||
@@ -131,14 +125,13 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_DEDUCTION_CHANGES.value]
|
||||
)
|
||||
mailer.send_mail_deduction_changed_team(obj_identifier, obj_title, self, data_changes, users_to_notify)
|
||||
mailer.send_mail_deduction_changed_team(obj, self, data_changes, users_to_notify)
|
||||
|
||||
def send_mail_shared_data_deleted(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_data_deleted(self, obj, municipals_names):
|
||||
""" Sends a mail to the team members in case of deleted data
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -148,7 +141,7 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_DATA_DELETED.value]
|
||||
)
|
||||
mailer.send_mail_shared_data_deleted_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_data_deleted_team(obj, self, users_to_notify, municipals_names)
|
||||
|
||||
def remove_user(self, user):
|
||||
""" Removes a user from the team
|
||||
|
||||
@@ -83,12 +83,11 @@ class User(AbstractUser):
|
||||
name=group
|
||||
)
|
||||
|
||||
def send_mail_shared_access_removed(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_access_removed(self, obj, municipals_names):
|
||||
""" Sends a mail to the user in case of removed shared access
|
||||
|
||||
Args:
|
||||
obj_identifier ():
|
||||
obj_title ():
|
||||
obj ():
|
||||
municipals_names ():
|
||||
|
||||
Returns:
|
||||
@@ -97,14 +96,13 @@ 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, municipals_names)
|
||||
mailer.send_mail_shared_access_removed(obj, self, municipals_names)
|
||||
|
||||
def send_mail_shared_access_given(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_access_given(self, obj, municipals_names):
|
||||
""" Sends a mail to the user in case of given shared access
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -113,14 +111,13 @@ 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, municipals_names)
|
||||
mailer.send_mail_shared_access_given(obj, self, municipals_names)
|
||||
|
||||
def send_mail_shared_data_recorded(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_data_recorded(self, obj, municipals_names):
|
||||
""" Sends a mail to the user in case of shared data has been recorded
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -129,14 +126,13 @@ 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, municipals_names)
|
||||
mailer.send_mail_shared_data_recorded(obj, self, municipals_names)
|
||||
|
||||
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_data_unrecorded(self, obj, municipals_names):
|
||||
""" Sends a mail to the user in case of shared data has been unrecorded
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -145,14 +141,13 @@ 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, municipals_names)
|
||||
mailer.send_mail_shared_data_unrecorded(obj, self, municipals_names)
|
||||
|
||||
def send_mail_shared_data_deleted(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_data_deleted(self, obj, municipals_names):
|
||||
""" Sends a mail to the user in case of shared data has been deleted
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -161,14 +156,13 @@ 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, municipals_names)
|
||||
mailer.send_mail_shared_data_deleted(obj, self, municipals_names)
|
||||
|
||||
def send_mail_shared_data_checked(self, obj_identifier, obj_title, municipals_names):
|
||||
def send_mail_shared_data_checked(self, obj, municipals_names):
|
||||
""" Sends a mail to the user in case of shared data has been deleted
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
obj (): The entry
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@@ -177,14 +171,13 @@ 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, municipals_names)
|
||||
mailer.send_mail_shared_data_checked(obj, self, municipals_names)
|
||||
|
||||
def send_mail_deduction_changed(self, obj_identifier, obj_title, data_changes):
|
||||
def send_mail_deduction_changed(self, obj, data_changes):
|
||||
""" Sends a mail to the user in case of a changed deduction
|
||||
|
||||
Args:
|
||||
obj_identifier (str): Identifier of the main object
|
||||
obj_title (str): Title of the main object
|
||||
obj (): The object
|
||||
data_changes (dict): Contains the old|new changes of the deduction changes
|
||||
|
||||
Returns:
|
||||
@@ -193,7 +186,7 @@ class User(AbstractUser):
|
||||
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_DEDUCTION_CHANGES)
|
||||
if notification_set:
|
||||
mailer = Mailer()
|
||||
mailer.send_mail_deduction_changed(obj_identifier, obj_title, self, data_changes)
|
||||
mailer.send_mail_deduction_changed(obj, self, data_changes)
|
||||
|
||||
def get_API_token(self):
|
||||
""" Getter for an API token
|
||||
|
||||
Reference in New Issue
Block a user