mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: notification filtering
This commit is contained in:
parent
90c819b1ba
commit
6c3be6faba
@ -45,21 +45,21 @@ class NotificationViewSet(BaseViewSet):
|
|||||||
issue_ids = IssueSubscriber.objects.filter(
|
issue_ids = IssueSubscriber.objects.filter(
|
||||||
workspace__slug=slug, subsriber_id=request.user.id
|
workspace__slug=slug, subsriber_id=request.user.id
|
||||||
).values_list("issue_id", flat=True)
|
).values_list("issue_id", flat=True)
|
||||||
notifications = notifications.filter(entity_id__in=issue_ids)
|
notifications = notifications.filter(entity_identifier__in=issue_ids)
|
||||||
|
|
||||||
# Assigned Issues
|
# Assigned Issues
|
||||||
if type == "assigned":
|
if type == "assigned":
|
||||||
issue_ids = IssueAssignee.objects.filter(
|
issue_ids = IssueAssignee.objects.filter(
|
||||||
workspace__slug=slug, assignee_id=request.user.id
|
workspace__slug=slug, assignee_id=request.user.id
|
||||||
).values_list("issue_id", flat=True)
|
).values_list("issue_id", flat=True)
|
||||||
notifications = notifications.filter(entity_id__in=issue_ids)
|
notifications = notifications.filter(entity_identifier__in=issue_ids)
|
||||||
|
|
||||||
# Created issues
|
# Created issues
|
||||||
if type == "created":
|
if type == "created":
|
||||||
issue_ids = Issue.objects.filter(
|
issue_ids = Issue.objects.filter(
|
||||||
workspace__slug=slug, created_by=request.user
|
workspace__slug=slug, created_by=request.user
|
||||||
).values_list("pk", flat=True)
|
).values_list("pk", flat=True)
|
||||||
notifications = notifications.filter(entity_id__in=issue_ids)
|
notifications = notifications.filter(entity_identifier__in=issue_ids)
|
||||||
|
|
||||||
if snoozed == "false":
|
if snoozed == "false":
|
||||||
notifications = notifications.filter(
|
notifications = notifications.filter(
|
||||||
@ -69,7 +69,7 @@ class NotificationViewSet(BaseViewSet):
|
|||||||
serializer = NotificationSerializer(notifications, many=True)
|
serializer = NotificationSerializer(notifications, many=True)
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
capture_exception(e)
|
print(e)
|
||||||
return Response(
|
return Response(
|
||||||
{"error": "Something went wrong please try again later"},
|
{"error": "Something went wrong please try again later"},
|
||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
|
Loading…
Reference in New Issue
Block a user