# 63 Mail recording/unrecording

* adds mail sending in case of unrecording and recording of data
* adds/updates translations
This commit is contained in:
2022-01-12 15:09:52 +01:00
parent eb54443aca
commit d7a9f72c3e
8 changed files with 230 additions and 15 deletions

View File

@@ -11,7 +11,8 @@ 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
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
from user.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
@@ -218,6 +219,11 @@ class RecordableObjectMixin(models.Model):
self.recorded = None
self.save()
self.log.add(action)
shared_users = self.users.all().values_list("id", flat=True)
for user_id in shared_users:
celery_send_mail_shared_data_unrecorded(self.identifier, user_id)
return action
def set_recorded(self, user: User):
@@ -235,6 +241,11 @@ class RecordableObjectMixin(models.Model):
self.recorded = action
self.save()
self.log.add(action)
shared_users = self.users.all().values_list("id", flat=True)
for user_id in shared_users:
celery_send_mail_shared_data_recorded(self.identifier, user_id)
return action
def mark_as_edited(self, performing_user: User, request: HttpRequest = None, edit_comment: str = None):