From d7445b3b5c13081edf37dfd77b12cdbad1c6035a Mon Sep 17 00:00:00 2001 From: Daniel Muremwa Mburu Date: Mon, 1 May 2023 17:00:05 +0300 Subject: [PATCH] mentioned users in comments are discarded, closes #24 --- api/views.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/views.py b/api/views.py index 1020149..95f5eb5 100644 --- a/api/views.py +++ b/api/views.py @@ -159,15 +159,15 @@ def comment_actions_v2(request, comment_pk): comment.comment_text = processed_comment.get('processed_comment') comment.modified = timezone.now() comment.save() - notify = [] - # add mentioned users + # notify users + notify = [] for mentioned in processed_comment.get('mentioned'): - if mentioned.profile not in comment.mentioned.all(): - comment.mentioned.add(mentioned.profile) + if mentioned.profile not in comment.mentioned.all() and mentioned != comment.note.user: + notify.append(mentioned) - if mentioned != comment.note.user: - notify.append(mentioned) + # add mentioned users + comment.mentioned.set(map(lambda usr: usr.profile, processed_comment.get('mentioned'))) # notify new mentioned users if notify: