Add feature flag for the GraphQL API

This commit is contained in:
Juanjo Bazán
2017-11-23 12:11:27 +01:00
committed by Javi Martín
parent bb627a7117
commit 0063e7b4d8
5 changed files with 15 additions and 0 deletions

View File

@@ -1,4 +1,7 @@
class GraphqlController < ApplicationController class GraphqlController < ApplicationController
include FeatureFlags
feature_flag :graphql_api
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
skip_authorization_check skip_authorization_check

View File

@@ -99,6 +99,7 @@ class Setting < ApplicationRecord
"feature.translation_interface": nil, "feature.translation_interface": nil,
"feature.remote_census": nil, "feature.remote_census": nil,
"feature.valuation_comment_notification": true, "feature.valuation_comment_notification": true,
"feature.graphql_api": true,
"homepage.widgets.feeds.debates": true, "homepage.widgets.feeds.debates": true,
"homepage.widgets.feeds.processes": true, "homepage.widgets.feeds.processes": true,
"homepage.widgets.feeds.proposals": true, "homepage.widgets.feeds.proposals": true,

View File

@@ -124,6 +124,7 @@ en:
remote_census_description: "Allows to configure the connection to the remote census of each institution" remote_census_description: "Allows to configure the connection to the remote census of each institution"
valuation_comment_notification: "Valuation comment notification" valuation_comment_notification: "Valuation comment notification"
valuation_comment_notification_description: "Send an email to all associated users except valuation commenter to budget investment when a new valuation comment is created" valuation_comment_notification_description: "Send an email to all associated users except valuation commenter to budget investment when a new valuation comment is created"
graphql_api: "GraphQL API"
remote_census: remote_census:
general: general:
endpoint: "Endpoint" endpoint: "Endpoint"

View File

@@ -124,6 +124,7 @@ es:
remote_census_description: "Permite configurar la conexión al censo remoto de cada institución" remote_census_description: "Permite configurar la conexión al censo remoto de cada institución"
valuation_comment_notification: "Notificar comentarios de evaluación" valuation_comment_notification: "Notificar comentarios de evaluación"
valuation_comment_notification_description: "Envía un email a todos los usuarios menos al que haya comentado asociados a un presupuesto participativo cuando se cree un nuevo comentario de evaluación" valuation_comment_notification_description: "Envía un email a todos los usuarios menos al que haya comentado asociados a un presupuesto participativo cuando se cree un nuevo comentario de evaluación"
graphql_api: "API GraphQL"
remote_census: remote_census:
general: general:
endpoint: "Endpoint" endpoint: "Endpoint"

View File

@@ -90,4 +90,13 @@ describe GraphqlController, type: :request do
expect(response).to have_http_status(:ok) expect(response).to have_http_status(:ok)
end end
end end
context "feature flag is set to false" do
before { Setting["feature.graphql_api"] = false }
it "is disabled" do
expect { get "/graphql" }.to raise_exception(FeatureFlags::FeatureDisabled)
expect { post "/graphql" }.to raise_exception(FeatureFlags::FeatureDisabled)
end
end
end end