fix: inbox issue deletes (#2290)

This commit is contained in:
Nikhil 2023-09-28 13:14:37 +05:30 committed by GitHub
parent 9dd22f07f4
commit 32d2f912f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -370,6 +370,11 @@ class InboxIssueViewSet(BaseViewSet):
if project_member.role <= 10 and str(inbox_issue.created_by_id) != str(request.user.id):
return Response({"error": "You cannot delete inbox issue"}, status=status.HTTP_400_BAD_REQUEST)
# Check the issue status
if inbox_issue.status in [-2, -1, 0, 2]:
# Delete the issue also
Issue.objects.filter(workspace__slug=slug, project_id=project_id, pk=inbox_issue.issue_id).delete()
inbox_issue.delete()
return Response(status=status.HTTP_204_NO_CONTENT)
except InboxIssue.DoesNotExist: