Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-02-13 20:26:00 +0300
committerLin Jen-Shin <godfat@godfat.org>2019-02-14 10:52:17 +0300
commit50491d324135f14e817d7de9d825b9ce4dacc5ef (patch)
treec0a187360e24d40a95f48b1e1a150840384dd2b3 /lib/gitlab/graphql/authorize
parent30918929ad079a591b85303d6662ec0a43c5df04 (diff)
Instead of returning all or nothing, return whichever passed
And add tests
Diffstat (limited to 'lib/gitlab/graphql/authorize')
-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