Merge pull request #751 from Rohit10jr/fix/leads-detail-404

fix(leads): return 404 instead of 500 for an unknown lead on comment/attachment POST
This commit is contained in:
Ashwin Kumar 2026-08-12 22:52:56 +05:30 committed by GitHub
commit 66f5ea77e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -597,12 +597,7 @@ class LeadDetailView(APIView):
params = request.data
context = {}
self.lead_obj = Lead.objects.get(pk=pk)
if self.lead_obj.org != request.profile.org:
return Response(
{"error": True, "errors": "User company doesnot match with header...."},
status=status.HTTP_403_FORBIDDEN,
)
self.lead_obj = get_object_or_404(Lead, id=pk, org=self.request.profile.org)
if (
not is_org_admin(self.request.profile)
and not self.request.user.is_superuser