# 63 Mail data deleted

* adds mail sending if shared data is deleted
* adds/updates translations
* refactors recording mails into separate email template folder email/recording
This commit is contained in:
2022-01-12 15:31:25 +01:00
parent d7a9f72c3e
commit 5295c08d99
10 changed files with 160 additions and 68 deletions

View File

@@ -12,7 +12,7 @@ from abc import abstractmethod
from django.contrib import messages
from konova.tasks import celery_send_mail_shared_access_removed, celery_send_mail_shared_access_given, \
celery_send_mail_shared_data_recorded, celery_send_mail_shared_data_unrecorded
celery_send_mail_shared_data_recorded, celery_send_mail_shared_data_unrecorded, celery_send_mail_shared_data_deleted
from user.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
@@ -121,6 +121,12 @@ class BaseObject(BaseResource):
action = UserActionLogEntry.get_deleted_action(user)
self.deleted = action
self.log.add(action)
# Send mail
shared_users = self.users.all().values_list("id", flat=True)
for user_id in shared_users:
celery_send_mail_shared_data_deleted.delay(self.identifier, user_id)
self.save()
def add_log_entry(self, action: UserAction, user: User, comment: str):