Skip to content

Commit

Permalink
Add more details in comment notifs
Browse files Browse the repository at this point in the history
  • Loading branch information
c-e-p committed Feb 25, 2024
1 parent ae50525 commit f5d8daa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ourchive_app/api/serializers.py
Expand Up @@ -444,15 +444,15 @@ def create(self, validated_data):
notification_type = NotificationType.objects.filter(
type_label="Comment Notification").first()
notification = Notification.objects.create(notification_type=notification_type, user=user, title="New Chapter Comment",
content=f"""A new comment has been left on your chapter! <a href='{comment_link}'>Click here</a> to view.""")
content=f"""A new comment for the work {comment.chapter.work.title} has been left on chapter {comment.chapter.title}! <a href='{comment_link}'>Click here</a> to view.""")
notification.save()
user.has_notifications = True
user.save()
if comment.parent_comment is not None and comment.parent_comment.user.id != comment.chapter.user.id:
user = User.objects.filter(id=comment.parent_comment.user.id).first()
notification_type = NotificationType.objects.filter(type_label="Comment Notification").first()
notification = Notification.objects.create(notification_type=notification_type, user=user, title="New Reply",
content=f"""A new reply has been made to your comment. <a href='{comment_link}'>Click here</a> to view.""")
content=f"""A new reply has been made to your comment on {comment.chapter.work.title}. <a href='{comment_link}'>Click here</a> to view.""")
notification.save()
user.has_notifications = True
user.save()
Expand Down Expand Up @@ -492,7 +492,7 @@ def create(self, validated_data):
notification_type = NotificationType.objects.filter(
type_label="Comment Notification").first()
notification = Notification.objects.create(notification_type=notification_type, user=user, title="New Bookmark Comment",
content=f"""A new comment has been left on your bookmark! <a href='/bookmarks/{comment.bookmark.id}/?expandComments=true&scrollCommentId={comment.id}&comment_offset=0'>Click here</a> to view.""")
content=f"""A new comment has been left on your bookmark titled {comment.bookmark.title}! <a href='/bookmarks/{comment.bookmark.id}/?expandComments=true&scrollCommentId={comment.id}&comment_offset=0'>Click here</a> to view.""")
notification.save()
user.has_notifications = True
user.save()
Expand All @@ -502,7 +502,7 @@ def create(self, validated_data):
user = User.objects.filter(id=comment.parent_comment.user.id).first()
notification_type = NotificationType.objects.filter(type_label="Comment Notification").first()
notification = Notification.objects.create(notification_type=notification_type, user=user, title="New Reply",
content=f"""A new reply has been made to your comment. <a href='/bookmarks/{comment.bookmark.id}/?expandComments=true&scrollCommentId={comment.id}&comment_offset=0'>Click here</a> to view.""")
content=f"""A new reply has been made to your comment on the bookmark titled {comment.bookmark.title}. <a href='/bookmarks/{comment.bookmark.id}/?expandComments=true&scrollCommentId={comment.id}&comment_offset=0'>Click here</a> to view.""")
notification.save()
user.has_notifications = True
user.save()
Expand Down Expand Up @@ -542,7 +542,7 @@ def create(self, validated_data):
notification_type = NotificationType.objects.filter(
type_label="Comment Notification").first()
notification = Notification.objects.create(notification_type=notification_type, user=user, title="New Collection Comment",
content=f"""A new comment has been left on your collection! <a href='/bookmark-collections/{comment.collection.id}/?expandComments=true&scrollCommentId={comment.id}&comment_offset=0'>Click here</a> to view.""")
content=f"""A new comment has been left on your collection titled {comment.collection.title}! <a href='/bookmark-collections/{comment.collection.id}/?expandComments=true&scrollCommentId={comment.id}&comment_offset=0'>Click here</a> to view.""")
notification.save()
user.has_notifications = True
user.save()
Expand All @@ -552,7 +552,7 @@ def create(self, validated_data):
user = User.objects.filter(id=comment.parent_comment.user.id).first()
notification_type = NotificationType.objects.filter(type_label="Comment Notification").first()
notification = Notification.objects.create(notification_type=notification_type, user=user, title="New Reply",
content=f"""A new reply has been made to your comment. <a href='/bookmark-collections/{comment.collection.id}/?expandComments=true&scrollCommentId={comment.id}&comment_offset=0'>Click here</a> to view.""")
content=f"""A new reply has been made to your comment on the collection titled {comment.collection.title}! <a href='/bookmark-collections/{comment.collection.id}/?expandComments=true&scrollCommentId={comment.id}&comment_offset=0'>Click here</a> to view.""")
notification.save()
user.has_notifications = True
user.save()
Expand Down

0 comments on commit f5d8daa

Please sign in to comment.