From 5295c08d99c2fb361ec3a8d6fba1f0c868204016 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 12 Jan 2022 15:31:25 +0100 Subject: [PATCH] # 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 --- konova/models/object.py | 8 +- konova/tasks.py | 7 + konova/utils/mailer.py | 30 +++- locale/de/LC_MESSAGES/django.mo | Bin 33012 -> 33399 bytes locale/de/LC_MESSAGES/django.po | 140 ++++++++++-------- .../email/deleting/shared_data_deleted.html | 26 ++++ .../shared_data_recorded.html | 0 .../shared_data_unrecorded.html | 0 user/models/user.py | 14 ++ user/models/user_action.py | 3 - 10 files changed, 160 insertions(+), 68 deletions(-) create mode 100644 templates/email/deleting/shared_data_deleted.html rename templates/email/{sharing => recording}/shared_data_recorded.html (100%) rename templates/email/{sharing => recording}/shared_data_unrecorded.html (100%) diff --git a/konova/models/object.py b/konova/models/object.py index 175cf3a8..8353a04d 100644 --- a/konova/models/object.py +++ b/konova/models/object.py @@ -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): diff --git a/konova/tasks.py b/konova/tasks.py index ee7aabd7..16925e57 100644 --- a/konova/tasks.py +++ b/konova/tasks.py @@ -44,3 +44,10 @@ def celery_send_mail_shared_data_unrecorded(obj_identifier, user_id): from user.models import User user = User.objects.get(id=user_id) user.send_mail_shared_data_unrecorded(obj_identifier) + + +@shared_task +def celery_send_mail_shared_data_deleted(obj_identifier, user_id): + from user.models import User + user = User.objects.get(id=user_id) + user.send_mail_shared_data_deleted(obj_identifier) diff --git a/konova/utils/mailer.py b/konova/utils/mailer.py index 107ac8ce..b919164d 100644 --- a/konova/utils/mailer.py +++ b/konova/utils/mailer.py @@ -94,7 +94,7 @@ class Mailer: ) def send_mail_shared_data_recorded(self, obj_identifier, user): - """ Send a mail if user just got access to the object + """ Send a mail if the user's shared data has just been unrecorded Args: obj_identifier (str): The object identifier @@ -107,7 +107,7 @@ class Mailer: "obj_identifier": obj_identifier, "EMAIL_REPLY_TO": EMAIL_REPLY_TO, } - msg = render_to_string("email/sharing/shared_data_recorded.html", context) + msg = render_to_string("email/recording/shared_data_recorded.html", context) user_mail_address = [user.email] self.send( user_mail_address, @@ -116,6 +116,28 @@ class Mailer: ) def send_mail_shared_data_unrecorded(self, obj_identifier, user): + """ Send a mail if the user's shared data has just been unrecorded + + Args: + obj_identifier (str): The object identifier + + Returns: + + """ + context = { + "user": user, + "obj_identifier": obj_identifier, + "EMAIL_REPLY_TO": EMAIL_REPLY_TO, + } + msg = render_to_string("email/recording/shared_data_unrecorded.html", context) + user_mail_address = [user.email] + self.send( + user_mail_address, + _("{} - Shared data unrecorded").format(obj_identifier), + msg + ) + + def send_mail_shared_data_deleted(self, obj_identifier, user): """ Send a mail if user just got access to the object Args: @@ -129,11 +151,11 @@ class Mailer: "obj_identifier": obj_identifier, "EMAIL_REPLY_TO": EMAIL_REPLY_TO, } - msg = render_to_string("email/sharing/shared_data_unrecorded.html", context) + msg = render_to_string("email/deleting/shared_data_deleted.html", context) user_mail_address = [user.email] self.send( user_mail_address, - _("{} - Shared data unrecorded").format(obj_identifier), + _("{} - Shared data deleted").format(obj_identifier), msg ) diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 77a572718db6aca9e38e8c7c235c74f00174dd7b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EL9 diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 012d25d7..6f82e795 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-12 15:06+0100\n" +"POT-Creation-Date: 2022-01-12 15:22+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1762,10 +1762,10 @@ msgid "{} - Shared access given" msgstr "{} - Zugriff freigegeben" #: konova/utils/mailer.py:114 -msgid "{} - Shared data recorded" -msgstr "{} - Freigegebene Daten verzeichnet" +msgid "{} - Shared data deleted" +msgstr "{} - Freigegebene Daten gelöscht" -#: konova/utils/mailer.py:136 +#: konova/utils/mailer.py:136 konova/utils/mailer.py:158 msgid "{} - Shared data unrecorded" msgstr "{} - Freigegebene Daten entzeichnet" @@ -1883,17 +1883,83 @@ msgstr "Alle" msgid "News" msgstr "Neuigkeiten" +#: templates/email/deleting/shared_data_deleted.html:4 +msgid "Shared data deleted" +msgstr "Freigegebene Daten gelöscht" + +#: templates/email/deleting/shared_data_deleted.html:8 +#: templates/email/recording/shared_data_recorded.html:8 +#: templates/email/recording/shared_data_unrecorded.html:8 +#: templates/email/sharing/shared_access_given.html:8 +#: templates/email/sharing/shared_access_removed.html:8 +msgid "Hello " +msgstr "Hallo " + +#: templates/email/deleting/shared_data_deleted.html:10 +msgid "the following dataset has just been deleted" +msgstr "der folgende Datensatz wurde soeben gelöscht " + +#: templates/email/deleting/shared_data_deleted.html:14 +msgid "" +"If this should not have been happened, please contact us. See the signature " +"for details." +msgstr "" +"Falls das nicht hätte passieren dürfen, kontaktieren Sie uns bitte. In der E-mail Signatur finden Sie " +"weitere Kontaktinformationen." + +#: templates/email/deleting/shared_data_deleted.html:17 +#: templates/email/recording/shared_data_recorded.html:17 +#: templates/email/recording/shared_data_unrecorded.html:17 +#: templates/email/sharing/shared_access_given.html:18 +#: templates/email/sharing/shared_access_removed.html:18 +msgid "Best regards" +msgstr "Beste Grüße" + +#: templates/email/recording/shared_data_recorded.html:4 +msgid "Shared data recorded" +msgstr "Freigegebene Daten verzeichnet" + +#: templates/email/recording/shared_data_recorded.html:10 +msgid "the following dataset has just been recorded" +msgstr "der folgende Datensatz wurde soeben verzeichnet " + +#: templates/email/recording/shared_data_recorded.html:14 +msgid "This means the data is now publicly available, e.g. in LANIS" +msgstr "" +"Das bedeutet, dass die Daten nun öffentlich verfügbar sind, z.B. im LANIS." + +#: templates/email/recording/shared_data_recorded.html:24 +msgid "" +"Please note: Recorded intervention means the compensations are recorded as " +"well." +msgstr "" +"Bitte beachten Sie: Verzeichnete Eingriffe bedeuten, dass auch die " +"zugehörigen Kompensationen automatisch verzeichnet sind." + +#: templates/email/recording/shared_data_unrecorded.html:4 +msgid "Shared data unrecorded" +msgstr "Freigegebene Daten entzeichnet" + +#: templates/email/recording/shared_data_unrecorded.html:10 +msgid "the following dataset has just been unrecorded" +msgstr "der folgende Datensatz wurde soeben entzeichnet " + +#: templates/email/recording/shared_data_unrecorded.html:14 +msgid "This means the data is no longer publicly available." +msgstr "Das bedeutet, dass die Daten nicht länger öffentlich verfügbar sind." + +#: templates/email/recording/shared_data_unrecorded.html:24 +msgid "" +"Please note: Unrecorded intervention means the compensations are unrecorded " +"as well." +msgstr "" +"Bitte beachten Sie: Entzeichnete Eingriffe bedeuten, dass auch die " +"zugehörigen Kompensationen automatisch entzeichnet worden sind." + #: templates/email/sharing/shared_access_given.html:4 msgid "Access shared" msgstr "Zugriff freigegeben" -#: templates/email/sharing/shared_access_given.html:8 -#: templates/email/sharing/shared_access_removed.html:8 -#: templates/email/sharing/shared_data_recorded.html:8 -#: templates/email/sharing/shared_data_unrecorded.html:8 -msgid "Hello " -msgstr "Hallo " - #: templates/email/sharing/shared_access_given.html:10 msgid "the following dataset has just been shared with you" msgstr "der folgende Datensatz wurde soeben für Sie freigegeben " @@ -1910,13 +1976,6 @@ msgstr "" "Der freigegebene Datensatz ist nun standardmäßig in Ihrer Übersicht für den " "Datensatztyp im KSP gelistet." -#: templates/email/sharing/shared_access_given.html:18 -#: templates/email/sharing/shared_access_removed.html:18 -#: templates/email/sharing/shared_data_recorded.html:17 -#: templates/email/sharing/shared_data_unrecorded.html:17 -msgid "Best regards" -msgstr "Beste Grüße" - #: templates/email/sharing/shared_access_given.html:25 msgid "" "Please note: Shared access on an intervention means you automatically have " @@ -1949,48 +2008,6 @@ msgstr "" "Nutzen Sie hierzu einfach die entsprechenden Suchfilter auf den " "Übersichtsseiten" -#: templates/email/sharing/shared_data_recorded.html:4 -msgid "Shared data recorded" -msgstr "Freigegebene Daten verzeichnet" - -#: templates/email/sharing/shared_data_recorded.html:10 -msgid "the following dataset has just been recorded" -msgstr "der folgende Datensatz wurde soeben verzeichnet " - -#: templates/email/sharing/shared_data_recorded.html:14 -msgid "This means the data is now publicly available, e.g. in LANIS" -msgstr "" -"Das bedeutet, dass die Daten nun öffentlich verfügbar sind, z.B. im LANIS." - -#: templates/email/sharing/shared_data_recorded.html:24 -msgid "" -"Please note: Recorded intervention means the compensations are recorded as " -"well." -msgstr "" -"Bitte beachten Sie: Verzeichnete Eingriffe bedeuten, dass auch die " -"zugehörigen Kompensationen automatisch verzeichnet sind." - -#: templates/email/sharing/shared_data_unrecorded.html:4 -msgid "Shared data unrecorded" -msgstr "Freigegebene Daten entzeichnet" - -#: templates/email/sharing/shared_data_unrecorded.html:10 -msgid "the following dataset has just been unrecorded" -msgstr "der folgende Datensatz wurde soeben entzeichnet " - -#: templates/email/sharing/shared_data_unrecorded.html:14 -msgid "This means the data is no longer publicly available." -msgstr "" -"Das bedeutet, dass die Daten nicht länger öffentlich verfügbar sind." - -#: templates/email/sharing/shared_data_unrecorded.html:24 -msgid "" -"Please note: Unrecorded intervention means the compensations are unrecorded " -"as well." -msgstr "" -"Bitte beachten Sie: Entzeichnete Eingriffe bedeuten, dass auch die " -"zugehörigen Kompensationen automatisch entzeichnet worden sind." - #: templates/email/signature.html:6 msgid "Please do not reply on this mail." msgstr "Bitte antworten Sie nicht auf diese Mail." @@ -3730,6 +3747,9 @@ msgstr "" msgid "Unable to connect to qpid with SASL mechanism %s" msgstr "" +#~ msgid "{} - Shared data recorded" +#~ msgstr "{} - Freigegebene Daten verzeichnet" + #~ msgid "Not recorded" #~ msgstr "Noch nicht verzeichnet" diff --git a/templates/email/deleting/shared_data_deleted.html b/templates/email/deleting/shared_data_deleted.html new file mode 100644 index 00000000..36c80b09 --- /dev/null +++ b/templates/email/deleting/shared_data_deleted.html @@ -0,0 +1,26 @@ +{% load i18n %} + +
+

{% trans 'Shared data deleted' %}

+

{{obj_identifier}}

+
+
+ {% trans 'Hello ' %} {{user.username}}, +
+ {% trans 'the following dataset has just been deleted' %} +
+ '{{obj_identifier}}' +
+ {% trans 'If this should not have been happened, please contact us. See the signature for details.' %} +
+
+ {% trans 'Best regards' %} +
+ KSP +
+
+
+ {% include 'email/signature.html' %} +
+
+ diff --git a/templates/email/sharing/shared_data_recorded.html b/templates/email/recording/shared_data_recorded.html similarity index 100% rename from templates/email/sharing/shared_data_recorded.html rename to templates/email/recording/shared_data_recorded.html diff --git a/templates/email/sharing/shared_data_unrecorded.html b/templates/email/recording/shared_data_unrecorded.html similarity index 100% rename from templates/email/sharing/shared_data_unrecorded.html rename to templates/email/recording/shared_data_unrecorded.html diff --git a/user/models/user.py b/user/models/user.py index 51c8bcf8..12f138e7 100644 --- a/user/models/user.py +++ b/user/models/user.py @@ -76,3 +76,17 @@ class User(AbstractUser): if notification_set: mailer = Mailer() mailer.send_mail_shared_data_unrecorded(obj_identifier, self) + + def send_mail_shared_data_deleted(self, obj_identifier): + """ Sends a mail to the user in case of shared data has been deleted + + Args: + obj_identifier (): + + Returns: + + """ + 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, self) diff --git a/user/models/user_action.py b/user/models/user_action.py index 72e86151..d902c5d7 100644 --- a/user/models/user_action.py +++ b/user/models/user_action.py @@ -49,9 +49,6 @@ class UserActionLogEntry(models.Model): "-timestamp", ) - def __str__(self): - return "{} | {} | {}".format(self.user.username, self.timestamp, self.action) - @property def action_humanize(self): """ Returns humanized version of enum