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:
Diffstat (limited to 'app/graphql/mutations/work_items/create.rb')
-rw-r--r--app/graphql/mutations/work_items/create.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/graphql/mutations/work_items/create.rb b/app/graphql/mutations/work_items/create.rb
index 9f7b7b5db97..7ce508e5ef1 100644
--- a/app/graphql/mutations/work_items/create.rb
+++ b/app/graphql/mutations/work_items/create.rb
@@ -14,6 +14,7 @@ module Mutations
authorize :create_work_item
MUTUALLY_EXCLUSIVE_ARGUMENTS_ERROR = 'Please provide either projectPath or namespacePath argument, but not both.'
+ DISABLED_FF_ERROR = 'namespace_level_work_items feature flag is disabled. Only project paths allowed.'
argument :confidential, GraphQL::Types::Boolean,
required: false,
@@ -59,6 +60,7 @@ module Mutations
def resolve(project_path: nil, namespace_path: nil, **attributes)
container_path = project_path || namespace_path
container = authorized_find!(container_path)
+ check_feature_available!(container)
params = global_id_compatibility_params(attributes).merge(author_id: current_user.id)
type = ::WorkItems::Type.find(attributes[:work_item_type_id])
@@ -81,6 +83,12 @@ module Mutations
private
+ def check_feature_available!(container)
+ return unless container.is_a?(::Group) && Feature.disabled?(:namespace_level_work_items, container)
+
+ raise Gitlab::Graphql::Errors::ArgumentError, DISABLED_FF_ERROR
+ end
+
def global_id_compatibility_params(params)
params[:work_item_type_id] = params[:work_item_type_id]&.model_id