Commit 744f6ed1 authored by Phil Hughes's avatar Phil Hughes

Enable GraphQL API endpoint

parent 2bb468d6
...@@ -43,6 +43,6 @@ class GraphqlController < ApplicationController ...@@ -43,6 +43,6 @@ class GraphqlController < ApplicationController
end end
def check_graphql_feature_flag! def check_graphql_feature_flag!
render_404 unless Feature.enabled?(:graphql, default_enabled: true) render_404 unless Gitlab::Graphql.enabled?
end end
end end
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
= render 'shared/issuable/form/template_selector', issuable: issuable = render 'shared/issuable/form/template_selector', issuable: issuable
= render 'shared/issuable/form/title', issuable: issuable, form: form, has_wip_commits: commits && commits.detect(&:work_in_progress?) = render 'shared/issuable/form/title', issuable: issuable, form: form, has_wip_commits: commits && commits.detect(&:work_in_progress?)
- if Feature.enabled?(:graphql, default_enabled: true) - if Gitlab::Graphql.enabled?
#js-suggestions{ data: { project_path: @project.full_path } } #js-suggestions{ data: { project_path: @project.full_path } }
= render 'shared/form_elements/description', model: issuable, form: form, project: project = render 'shared/form_elements/description', model: issuable, form: form, project: project
......
constraints(::Constraints::FeatureConstrainer.new(:graphql)) do constraints(::Constraints::FeatureConstrainer.new(:graphql, nil, true)) do
post '/api/graphql', to: 'graphql#execute' post '/api/graphql', to: 'graphql#execute'
mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: '/api/graphql' mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: '/api/graphql'
end end
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
module Constraints module Constraints
class FeatureConstrainer class FeatureConstrainer
attr_reader :feature attr_reader :feature, :thing, :default_enabled
def initialize(feature) def initialize(feature, thing, default_enabled)
@feature = feature @feature, @thing, @default_enabled = feature, thing, default_enabled
end end
def matches?(_request) def matches?(_request)
Feature.enabled?(feature) Feature.enabled?(feature, @thing, default_enabled: true)
end end
end end
end end
...@@ -3,5 +3,9 @@ ...@@ -3,5 +3,9 @@
module Gitlab module Gitlab
module Graphql module Graphql
StandardGraphqlError = Class.new(StandardError) StandardGraphqlError = Class.new(StandardError)
def self.enabled?
Feature.enabled?(:graphql, default_enabled: true)
end
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