Object mailing restructred

* restructures object info mail sending
This commit is contained in:
2023-12-11 12:06:33 +01:00
parent 75ab281799
commit 743bb320d7
21 changed files with 196 additions and 224 deletions

View File

@@ -123,7 +123,7 @@ class DeletableObjectMixin(models.Model):
# Send mail
shared_teams = self.shared_teams.values_list("id", flat=True)
for team_id in shared_teams:
celery_send_mail_shared_data_deleted_team.delay(self.identifier, self.title, team_id, municipals_names)
celery_send_mail_shared_data_deleted_team.delay(self.id, self.__class__, team_id, municipals_names)
self.save()
@@ -256,10 +256,10 @@ class RecordableObjectMixin(models.Model):
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
for user_id in shared_users:
celery_send_mail_shared_data_unrecorded.delay(self.identifier, self.title, user_id, municipals_names)
celery_send_mail_shared_data_unrecorded.delay(self.id, self.__class__, user_id, municipals_names)
for team_id in shared_teams:
celery_send_mail_shared_data_unrecorded_team.delay(self.identifier, self.title, team_id, municipals_names)
celery_send_mail_shared_data_unrecorded_team.delay(self.id, self.__class__, team_id, municipals_names)
return action
@@ -287,10 +287,10 @@ class RecordableObjectMixin(models.Model):
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
for user_id in shared_users:
celery_send_mail_shared_data_recorded.delay(self.identifier, self.title, user_id, municipals_names)
celery_send_mail_shared_data_recorded.delay(self.id, self.__class__, user_id, municipals_names)
for team_id in shared_teams:
celery_send_mail_shared_data_recorded_team.delay(self.identifier, self.title, team_id, municipals_names)
celery_send_mail_shared_data_recorded_team.delay(self.id, self.__class__, team_id, municipals_names)
return action
@@ -366,12 +366,12 @@ class CheckableObjectMixin(models.Model):
# Send mail
shared_users = self.shared_users.values_list("id", flat=True)
for user_id in shared_users:
celery_send_mail_shared_data_checked.delay(self.identifier, self.title, user_id, municipals_names)
celery_send_mail_shared_data_checked.delay(self.id, self.__class__, user_id, municipals_names)
# Send mail
shared_teams = self.shared_teams.values_list("id", flat=True)
for team_id in shared_teams:
celery_send_mail_shared_data_checked_team.delay(self.identifier, self.title, team_id, municipals_names)
celery_send_mail_shared_data_checked_team.delay(self.id, self.__class__, team_id, municipals_names)
self.log.add(action)
return action
@@ -556,9 +556,9 @@ class ShareableObjectMixin(models.Model):
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
for team_id in new_teams:
celery_send_mail_shared_access_given_team.delay(self.identifier, self.title, team_id, municipals_names)
celery_send_mail_shared_access_given_team.delay(self.id, self.__class__, team_id, municipals_names)
for team_id in removed_teams:
celery_send_mail_shared_access_removed_team.delay(self.identifier, self.title, team_id, municipals_names)
celery_send_mail_shared_access_removed_team.delay(self.id, self.__class__, team_id, municipals_names)
self.share_with_team_list(accessing_teams)
@@ -586,9 +586,9 @@ class ShareableObjectMixin(models.Model):
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
# Send mails
for user_id in removed_users:
celery_send_mail_shared_access_removed.delay(self.identifier, self.title, user_id, municipals_names)
celery_send_mail_shared_access_removed(self.id, self.__class__, user_id, municipals_names)
for user_id in new_users:
celery_send_mail_shared_access_given.delay(self.identifier, self.title, user_id, municipals_names)
celery_send_mail_shared_access_given(self.id, self.__class__, user_id, municipals_names)
# Set new shared users
self.share_with_user_list(accessing_users)