86_User_suggestions_and_feedback #111
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -11,6 +11,8 @@
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>{{obj_title}}</strong>
|
||||
<br>
|
||||
{% trans 'This means, the responsible registration office just confirmed the correctness of this dataset.' %}
|
||||
<br>
|
||||
<br>
|
||||
|
@ -11,6 +11,8 @@
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% trans 'If this should not have been happened, please contact us. See the signature for details.' %}
|
||||
<br>
|
||||
<br>
|
||||
|
@ -11,6 +11,8 @@
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% trans 'This means the data is now publicly available, e.g. in LANIS' %}
|
||||
<br>
|
||||
<br>
|
||||
|
@ -11,6 +11,8 @@
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% trans 'This means the data is no longer publicly available.' %}
|
||||
<br>
|
||||
<br>
|
||||
|
@ -11,6 +11,8 @@
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% trans 'This means you can now edit this dataset.' %}
|
||||
{% trans 'The shared dataset appears now by default on your overview for this dataset type.' %}
|
||||
<br>
|
||||
|
@ -11,6 +11,8 @@
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% 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.' %}
|
||||
<br>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user