diff --git a/konova/models/object.py b/konova/models/object.py
index 0a802ed5..06256abb 100644
--- a/konova/models/object.py
+++ b/konova/models/object.py
@@ -128,7 +128,7 @@ class BaseObject(BaseResource):
# Send mail
shared_users = self.shared_users.values_list("id", flat=True)
for user_id in shared_users:
- celery_send_mail_shared_data_deleted.delay(self.identifier, user_id)
+ celery_send_mail_shared_data_deleted.delay(self.identifier, self.title, user_id)
self.save()
@@ -217,6 +217,10 @@ class BaseObject(BaseResource):
_str = "{}{}-{}".format(curr_month, curr_year, rand_str)
return definitions[self.__class__]["template"].format(_str)
+ @abstractmethod
+ def get_detail_url(self):
+ raise NotImplementedError()
+
class RecordableObjectMixin(models.Model):
""" Wraps record related fields and functionality
@@ -253,7 +257,7 @@ class RecordableObjectMixin(models.Model):
shared_users = self.users.all().values_list("id", flat=True)
for user_id in shared_users:
- celery_send_mail_shared_data_unrecorded.delay(self.identifier, user_id)
+ celery_send_mail_shared_data_unrecorded.delay(self.identifier, self.title, user_id)
return action
@@ -275,7 +279,7 @@ class RecordableObjectMixin(models.Model):
shared_users = self.users.all().values_list("id", flat=True)
for user_id in shared_users:
- celery_send_mail_shared_data_recorded.delay(self.identifier, user_id)
+ celery_send_mail_shared_data_recorded.delay(self.identifier, self.title, user_id)
return action
@@ -360,7 +364,7 @@ class CheckableObjectMixin(models.Model):
# Send mail
shared_users = self.users.all().values_list("id", flat=True)
for user_id in shared_users:
- celery_send_mail_shared_data_checked.delay(self.identifier, user_id)
+ celery_send_mail_shared_data_checked.delay(self.identifier, self.title, user_id)
self.log.add(action)
return action
@@ -474,9 +478,9 @@ class ShareableObjectMixin(models.Model):
# Send mails
for user in removed_users:
- celery_send_mail_shared_access_removed.delay(self.identifier, user["id"])
+ celery_send_mail_shared_access_removed.delay(self.identifier, self.title, user["id"])
for user in new_accessing_users:
- celery_send_mail_shared_access_given.delay(self.identifier, user)
+ celery_send_mail_shared_access_given.delay(self.identifier, self.title, user)
# Set new shared users
self.share_with_list(users)
diff --git a/konova/tasks.py b/konova/tasks.py
index a463374c..4c528038 100644
--- a/konova/tasks.py
+++ b/konova/tasks.py
@@ -19,42 +19,42 @@ def celery_update_parcels(geometry_id: str, recheck: bool = True):
@shared_task
-def celery_send_mail_shared_access_removed(obj_identifier, user_id):
+def celery_send_mail_shared_access_removed(obj_identifier, obj_title=None, user_id=None):
from user.models import User
user = User.objects.get(id=user_id)
- user.send_mail_shared_access_removed(obj_identifier)
+ user.send_mail_shared_access_removed(obj_identifier, obj_title)
@shared_task
-def celery_send_mail_shared_access_given(obj_identifier, user_id):
+def celery_send_mail_shared_access_given(obj_identifier, obj_title=None, user_id=None):
from user.models import User
user = User.objects.get(id=user_id)
- user.send_mail_shared_access_given(obj_identifier)
+ user.send_mail_shared_access_given(obj_identifier, obj_title)
@shared_task
-def celery_send_mail_shared_data_recorded(obj_identifier, user_id):
+def celery_send_mail_shared_data_recorded(obj_identifier, obj_title=None, user_id=None):
from user.models import User
user = User.objects.get(id=user_id)
- user.send_mail_shared_data_recorded(obj_identifier)
+ user.send_mail_shared_data_recorded(obj_identifier, obj_title)
@shared_task
-def celery_send_mail_shared_data_unrecorded(obj_identifier, user_id):
+def celery_send_mail_shared_data_unrecorded(obj_identifier, obj_title=None, user_id=None):
from user.models import User
user = User.objects.get(id=user_id)
- user.send_mail_shared_data_unrecorded(obj_identifier)
+ user.send_mail_shared_data_unrecorded(obj_identifier, obj_title)
@shared_task
-def celery_send_mail_shared_data_deleted(obj_identifier, user_id):
+def celery_send_mail_shared_data_deleted(obj_identifier, obj_title=None, user_id=None):
from user.models import User
user = User.objects.get(id=user_id)
- user.send_mail_shared_data_deleted(obj_identifier)
+ user.send_mail_shared_data_deleted(obj_identifier, obj_title)
@shared_task
-def celery_send_mail_shared_data_checked(obj_identifier, user_id):
+def celery_send_mail_shared_data_checked(obj_identifier, obj_title=None, user_id=None):
from user.models import User
user = User.objects.get(id=user_id)
- user.send_mail_shared_data_checked(obj_identifier)
+ user.send_mail_shared_data_checked(obj_identifier, obj_title)
diff --git a/konova/utils/mailer.py b/konova/utils/mailer.py
index e174ae56..33907f3c 100644
--- a/konova/utils/mailer.py
+++ b/konova/utils/mailer.py
@@ -45,11 +45,12 @@ class Mailer:
auth_password=self.auth_password
)
- def send_mail_shared_access_removed(self, obj_identifier, user):
+ def send_mail_shared_access_removed(self, obj_identifier, obj_title, user):
""" Send a mail if user has no access to the object anymore
Args:
obj_identifier (str): The object identifier
+ obj_title (str): The object title
Returns:
@@ -57,6 +58,7 @@ class Mailer:
context = {
"user": user,
"obj_identifier": obj_identifier,
+ "obj_title": obj_title,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/sharing/shared_access_removed.html", context)
@@ -67,7 +69,7 @@ class Mailer:
msg
)
- def send_mail_shared_access_given(self, obj_identifier, user):
+ def send_mail_shared_access_given(self, obj_identifier, obj_title, user):
""" Send a mail if user just got access to the object
Args:
@@ -79,6 +81,7 @@ class Mailer:
context = {
"user": user,
"obj_identifier": obj_identifier,
+ "obj_title": obj_title,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/sharing/shared_access_given.html", context)
@@ -89,7 +92,7 @@ class Mailer:
msg
)
- def send_mail_shared_data_recorded(self, obj_identifier, user):
+ def send_mail_shared_data_recorded(self, obj_identifier, obj_title, user):
""" Send a mail if the user's shared data has just been unrecorded
Args:
@@ -101,6 +104,7 @@ class Mailer:
context = {
"user": user,
"obj_identifier": obj_identifier,
+ "obj_title": obj_title,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/recording/shared_data_recorded.html", context)
@@ -111,7 +115,7 @@ class Mailer:
msg
)
- def send_mail_shared_data_unrecorded(self, obj_identifier, user):
+ def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title, user):
""" Send a mail if the user's shared data has just been unrecorded
Args:
@@ -123,6 +127,7 @@ class Mailer:
context = {
"user": user,
"obj_identifier": obj_identifier,
+ "obj_title": obj_title,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/recording/shared_data_unrecorded.html", context)
@@ -133,7 +138,7 @@ class Mailer:
msg
)
- def send_mail_shared_data_deleted(self, obj_identifier, user):
+ def send_mail_shared_data_deleted(self, obj_identifier, obj_title, user):
""" Send a mail if shared data has just been deleted
Args:
@@ -145,6 +150,7 @@ class Mailer:
context = {
"user": user,
"obj_identifier": obj_identifier,
+ "obj_title": obj_title,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/deleting/shared_data_deleted.html", context)
@@ -155,7 +161,7 @@ class Mailer:
msg
)
- def send_mail_shared_data_checked(self, obj_identifier, user):
+ def send_mail_shared_data_checked(self, obj_identifier, obj_title, user):
""" Send a mail if shared data just has been checked
Args:
@@ -167,6 +173,7 @@ class Mailer:
context = {
"user": user,
"obj_identifier": obj_identifier,
+ "obj_title": obj_title,
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
}
msg = render_to_string("email/checking/shared_data_checked.html", context)
diff --git a/templates/email/checking/shared_data_checked.html b/templates/email/checking/shared_data_checked.html
index 0707cfbc..0b67ecc7 100644
--- a/templates/email/checking/shared_data_checked.html
+++ b/templates/email/checking/shared_data_checked.html
@@ -11,6 +11,8 @@
{{obj_identifier}}
+ {{obj_title}}
+
{% trans 'This means, the responsible registration office just confirmed the correctness of this dataset.' %}
diff --git a/templates/email/deleting/shared_data_deleted.html b/templates/email/deleting/shared_data_deleted.html
index b920f1ec..272b0fde 100644
--- a/templates/email/deleting/shared_data_deleted.html
+++ b/templates/email/deleting/shared_data_deleted.html
@@ -11,6 +11,8 @@
{{obj_identifier}}
+ "{{obj_title}}"
+
{% trans 'If this should not have been happened, please contact us. See the signature for details.' %}
diff --git a/templates/email/recording/shared_data_recorded.html b/templates/email/recording/shared_data_recorded.html
index f8db9182..6805c928 100644
--- a/templates/email/recording/shared_data_recorded.html
+++ b/templates/email/recording/shared_data_recorded.html
@@ -11,6 +11,8 @@
{{obj_identifier}}
+ "{{obj_title}}"
+
{% trans 'This means the data is now publicly available, e.g. in LANIS' %}
diff --git a/templates/email/recording/shared_data_unrecorded.html b/templates/email/recording/shared_data_unrecorded.html
index d4639c9e..1e0310ae 100644
--- a/templates/email/recording/shared_data_unrecorded.html
+++ b/templates/email/recording/shared_data_unrecorded.html
@@ -11,6 +11,8 @@
{{obj_identifier}}
+ "{{obj_title}}"
+
{% trans 'This means the data is no longer publicly available.' %}
diff --git a/templates/email/sharing/shared_access_given.html b/templates/email/sharing/shared_access_given.html
index b8b26b7a..140e7a88 100644
--- a/templates/email/sharing/shared_access_given.html
+++ b/templates/email/sharing/shared_access_given.html
@@ -11,6 +11,8 @@
{{obj_identifier}}
+ "{{obj_title}}"
+
{% trans 'This means you can now edit this dataset.' %}
{% trans 'The shared dataset appears now by default on your overview for this dataset type.' %}
diff --git a/templates/email/sharing/shared_access_removed.html b/templates/email/sharing/shared_access_removed.html
index 86d4fddd..d1cbc5bf 100644
--- a/templates/email/sharing/shared_access_removed.html
+++ b/templates/email/sharing/shared_access_removed.html
@@ -11,6 +11,8 @@
{{obj_identifier}}
+ "{{obj_title}}"
+
{% trans 'However, you are still able to view the dataset content.' %}
{% trans 'Please use the provided search filter on the dataset`s overview pages to find them.' %}
diff --git a/user/models/user.py b/user/models/user.py
index 6370f2d5..df63dd76 100644
--- a/user/models/user.py
+++ b/user/models/user.py
@@ -60,11 +60,12 @@ class User(AbstractUser):
name=ETS_GROUP
).exists()
- def send_mail_shared_access_removed(self, obj_identifier):
+ def send_mail_shared_access_removed(self, obj_identifier, obj_title):
""" Sends a mail to the user in case of removed shared access
Args:
obj_identifier ():
+ obj_title ():
Returns:
@@ -72,9 +73,9 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_REMOVED)
if notification_set:
mailer = Mailer()
- mailer.send_mail_shared_access_removed(obj_identifier, self)
+ mailer.send_mail_shared_access_removed(obj_identifier, obj_title, self)
- def send_mail_shared_access_given(self, obj_identifier):
+ def send_mail_shared_access_given(self, obj_identifier, obj_title):
""" Sends a mail to the user in case of given shared access
Args:
@@ -86,9 +87,9 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_GAINED)
if notification_set:
mailer = Mailer()
- mailer.send_mail_shared_access_given(obj_identifier, self)
+ mailer.send_mail_shared_access_given(obj_identifier, obj_title, self)
- def send_mail_shared_data_recorded(self, obj_identifier):
+ def send_mail_shared_data_recorded(self, obj_identifier, obj_title):
""" Sends a mail to the user in case of shared data has been recorded
Args:
@@ -100,9 +101,9 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED)
if notification_set:
mailer = Mailer()
- mailer.send_mail_shared_data_recorded(obj_identifier, self)
+ mailer.send_mail_shared_data_recorded(obj_identifier, obj_title, self)
- def send_mail_shared_data_unrecorded(self, obj_identifier):
+ def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title):
""" Sends a mail to the user in case of shared data has been unrecorded
Args:
@@ -114,9 +115,9 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED)
if notification_set:
mailer = Mailer()
- mailer.send_mail_shared_data_unrecorded(obj_identifier, self)
+ mailer.send_mail_shared_data_unrecorded(obj_identifier, obj_title, self)
- def send_mail_shared_data_deleted(self, obj_identifier):
+ def send_mail_shared_data_deleted(self, obj_identifier, obj_title):
""" Sends a mail to the user in case of shared data has been deleted
Args:
@@ -128,9 +129,9 @@ class User(AbstractUser):
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)
+ mailer.send_mail_shared_data_deleted(obj_identifier, obj_title, self)
- def send_mail_shared_data_checked(self, obj_identifier):
+ def send_mail_shared_data_checked(self, obj_identifier, obj_title):
""" Sends a mail to the user in case of shared data has been deleted
Args:
@@ -142,7 +143,7 @@ class User(AbstractUser):
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_CHECKED)
if notification_set:
mailer = Mailer()
- mailer.send_mail_shared_data_checked(obj_identifier, self)
+ mailer.send_mail_shared_data_checked(obj_identifier, obj_title, self)
def get_API_token(self):
""" Getter for an API token