summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-02-14 01:26:00 +0800
committerLin Jen-Shin <godfat@godfat.org>2019-02-14 15:52:17 +0800
commit50491d324135f14e817d7de9d825b9ce4dacc5ef (patch)
treec0a187360e24d40a95f48b1e1a150840384dd2b3 /lib
parent30918929ad079a591b85303d6662ec0a43c5df04 (diff)
downloadgitlab-ce-50491d324135f14e817d7de9d825b9ce4dacc5ef.tar.gz
Instead of returning all or nothing, return whichever passed
And add tests
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/graphql/authorize/instrumentation.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/gitlab/graphql/authorize/instrumentation.rb b/lib/gitlab/graphql/authorize/instrumentation.rb
index d6d3ff300f6..2a3d790d67b 100644
--- a/lib/gitlab/graphql/authorize/instrumentation.rb
+++ b/lib/gitlab/graphql/authorize/instrumentation.rb
@@ -45,15 +45,12 @@ module Gitlab
end
end
- checked =
- case value
- when Array
- value.all?(&check)
- else
- check.call(value)
- end
-
- value if checked
+ case value
+ when Array
+ value.select(&check)
+ else
+ value if check.call(value)
+ end
end
end
end