Use subject scoping where possible in CI policy conditions
The following discussion from !150567 (merged) should be addressed:
-
@hmehra started a discussion: condition(:project_allows_read_build, scope: :subject) do can?(:read_build, @subject.project) end
Context
If a policy only uses @subject
, then adding this scope allows for improved caching (docs).
Proposal
Just changing that one line in an MR is barely worth the effort, so we might as well review some of our policies and make the change in more places.