Commit d31c908b authored by Arun Kumar Mohan's avatar Arun Kumar Mohan

Rename `conditionally_graphql!` to `run_graphql!`

And remove the unnecessary `fallback` parameter
parent 80713292
...@@ -6,7 +6,7 @@ module API ...@@ -6,7 +6,7 @@ module API
# against the graphql API. Helper code for the graphql server implementation # against the graphql API. Helper code for the graphql server implementation
# should be in app/graphql/ or lib/gitlab/graphql/ # should be in app/graphql/ or lib/gitlab/graphql/
module GraphqlHelpers module GraphqlHelpers
def conditionally_graphql!(fallback:, query:, context: {}, transform: nil) def run_graphql!(query:, context: {}, transform: nil)
result = GitlabSchema.execute(query, context: context) result = GitlabSchema.execute(query, context: context)
if transform if transform
......
...@@ -19,11 +19,10 @@ module API ...@@ -19,11 +19,10 @@ module API
detail 'This feature was introduced in GitLab 8.13.' detail 'This feature was introduced in GitLab 8.13.'
end end
get '/version' do get '/version' do
conditionally_graphql!( run_graphql!(
query: METADATA_QUERY, query: METADATA_QUERY,
context: { current_user: current_user }, context: { current_user: current_user },
transform: ->(result) { result.dig('data', 'metadata') }, transform: ->(result) { result.dig('data', 'metadata') }
fallback: -> { { version: Gitlab::VERSION, revision: Gitlab.revision } }
) )
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment