From a35ebf5b66a4e869f51245e0239522f704536bce Mon Sep 17 00:00:00 2001 From: NarayanBavisetti Date: Thu, 28 Nov 2024 12:52:19 +0530 Subject: [PATCH] fix: notification count --- apiserver/plane/app/views/notification/base.py | 4 ---- apiserver/plane/bgtasks/notification_task.py | 9 ++++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apiserver/plane/app/views/notification/base.py b/apiserver/plane/app/views/notification/base.py index 11d18ade399..d2aa1a02d7b 100644 --- a/apiserver/plane/app/views/notification/base.py +++ b/apiserver/plane/app/views/notification/base.py @@ -62,10 +62,6 @@ def list(self, request, slug): Notification.objects.filter( workspace__slug=slug, receiver_id=request.user.id ) - .filter( - project__project_projectmember__member=request.user, - project__project_projectmember__is_active=True, - ) .filter(entity_name="issue") .annotate(is_inbox_issue=Exists(intake_issue)) .annotate(is_intake_issue=Exists(intake_issue)) diff --git a/apiserver/plane/bgtasks/notification_task.py b/apiserver/plane/bgtasks/notification_task.py index 2adff6cc62c..ade24790965 100644 --- a/apiserver/plane/bgtasks/notification_task.py +++ b/apiserver/plane/bgtasks/notification_task.py @@ -1,6 +1,8 @@ # Python imports import json import uuid +from uuid import UUID + # Module imports from plane.db.models import ( @@ -255,7 +257,7 @@ def notifications( ) new_mentions = [ - str(mention) for mention in new_mentions if mention in new_mentions + str(mention) for mention in new_mentions if mention in set(project_members) ] removed_mention = get_removed_mentions( requested_instance=requested_data, current_instance=current_instance @@ -287,6 +289,11 @@ def notifications( new_value=issue_comment_new_value, ) comment_mentions = comment_mentions + new_comment_mentions + comment_mentions = [ + mention + for mention in comment_mentions + if UUID(mention) in set(project_members) + ] comment_mention_subscribers = extract_mentions_as_subscribers( project_id=project_id, issue_id=issue_id, mentions=all_comment_mentions