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
|
||||
|
||||
Reference in New Issue
Block a user