Addressing comments, updating tests, etc.

This commit is contained in:
beeankha
2019-08-23 12:45:13 -04:00
committed by Ryan Petrello
parent 9f0307404e
commit ea509f518e
6 changed files with 13 additions and 23 deletions

View File

@@ -4473,7 +4473,7 @@ class WorkflowApprovalApprove(RetrieveAPIView):
if not request.user.can_access(models.WorkflowApproval, 'approve_or_deny', obj):
raise PermissionDenied(detail=_("User does not have permission to approve or deny this workflow."))
if obj.status != 'pending':
return Response("This workflow step has already been approved or denied.", status=status.HTTP_400_BAD_REQUEST)
return Response({"error": _("This workflow step has already been approved or denied.")}, status=status.HTTP_400_BAD_REQUEST)
obj.approve(request)
return Response(status=status.HTTP_204_NO_CONTENT)
@@ -4488,6 +4488,6 @@ class WorkflowApprovalDeny(RetrieveAPIView):
if not request.user.can_access(models.WorkflowApproval, 'approve_or_deny', obj):
raise PermissionDenied(detail=_("User does not have permission to approve or deny this workflow."))
if obj.status != 'pending':
return Response("This workflow step has already been approved or denied.", status=status.HTTP_400_BAD_REQUEST)
return Response({"error": _("This workflow step has already been approved or denied.")}, status=status.HTTP_400_BAD_REQUEST)
obj.deny(request)
return Response(status=status.HTTP_204_NO_CONTENT)