Add notif for comment page author

This commit is contained in:
cuom1999 2022-05-17 22:34:08 -05:00
parent 1533607551
commit 6047d292dc
2 changed files with 31 additions and 3 deletions

View file

@ -131,10 +131,22 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
# add notification for reply
if comment.parent and comment.parent.author != comment.author:
notification_rep = Notification(
notification_reply = Notification(
owner=comment.parent.author, comment=comment, category="Reply"
)
notification_rep.save()
notification_reply.save()
# add notification for page authors
page_authors = comment.page_object.authors.all()
for user in page_authors:
if user == comment.author:
continue
notification = Notification(
owner=user, comment=comment, category="Comment"
)
notification.save()
# except Exception:
# pass
add_mention_notifications(comment)