From 1a5faca77c09f6e9f391eea755c800a74d8ac8eb Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Tue, 1 Aug 2023 14:16:21 +0530 Subject: [PATCH] chore: show created by empty for viewers and guests (#1740) * chore: show created by empty for viewers and guests * dev: return empty queryset --- apiserver/plane/api/views/notification.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apiserver/plane/api/views/notification.py b/apiserver/plane/api/views/notification.py index faf9df816..2abc82631 100644 --- a/apiserver/plane/api/views/notification.py +++ b/apiserver/plane/api/views/notification.py @@ -10,7 +10,7 @@ from plane.utils.paginator import BasePaginator # Module imports from .base import BaseViewSet, BaseAPIView -from plane.db.models import Notification, IssueAssignee, IssueSubscriber, Issue +from plane.db.models import Notification, IssueAssignee, IssueSubscriber, Issue, WorkspaceMember from plane.api.serializers import NotificationSerializer @@ -83,10 +83,13 @@ class NotificationViewSet(BaseViewSet, BasePaginator): # Created issues if type == "created": - issue_ids = Issue.objects.filter( - workspace__slug=slug, created_by=request.user - ).values_list("pk", flat=True) - notifications = notifications.filter(entity_identifier__in=issue_ids) + if WorkspaceMember.objects.filter(workspace__slug=slug, member=request.user, role__lt=15).exists(): + notifications = Notification.objects.none() + else: + issue_ids = Issue.objects.filter( + workspace__slug=slug, created_by=request.user + ).values_list("pk", flat=True) + notifications = notifications.filter(entity_identifier__in=issue_ids) # Pagination if request.GET.get("per_page", False) and request.GET.get("cursor", False):