# 63 Mail celery

* moves mail sending to celery worker using shared_task in konova/tasks.py
* adds mail sending for shared access given
* adds UserNotification settings checks for mail sending
* adds/updates translations
This commit is contained in:
2022-01-12 14:51:50 +01:00
parent dbf32f3138
commit 17dc3f7537
7 changed files with 147 additions and 20 deletions

View File

@@ -53,7 +53,7 @@ class Mailer:
""" Send a mail if user has no access to the object anymore
Args:
obj ():
obj_identifier (str): The object identifier
Returns:
@@ -71,3 +71,25 @@ class Mailer:
msg
)
def send_mail_shared_access_given(self, obj_identifier, user):
""" Send a mail if user just got access to the object
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/sharing/shared_access_given.html", context)
user_mail_address = [user.email]
self.send(
user_mail_address,
_("{} - Shared access given").format(obj_identifier),
msg
)