Fix canApprove GraphQL field returning null
What does this MR do and why?
The Approvable#eligible_for_unapproval_by?
can return nil
when user
is not present. The canApprove
GraphQL field is
required and not nullable though. As a result, it returns a
GraphQL error as a response to GraphQL query.
To fix that, we check if user.present?
instead of only user
.
Also updated the spec to check for true
and false
value to
ensure that it doesn't return a nil
value.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #416863 (closed)