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:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/graphql/mutations/namespace/package_settings/update.rb
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/graphql/mutations/namespace/package_settings/update.rb')
-rw-r--r--app/graphql/mutations/namespace/package_settings/update.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/app/graphql/mutations/namespace/package_settings/update.rb b/app/graphql/mutations/namespace/package_settings/update.rb
new file mode 100644
index 00000000000..ca21c3418fc
--- /dev/null
+++ b/app/graphql/mutations/namespace/package_settings/update.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+module Mutations
+ module Namespace
+ module PackageSettings
+ class Update < Mutations::BaseMutation
+ include Mutations::ResolvesNamespace
+
+ graphql_name 'UpdateNamespacePackageSettings'
+
+ authorize :create_package_settings
+
+ argument :namespace_path,
+ GraphQL::ID_TYPE,
+ required: true,
+ description: 'The namespace path where the namespace package setting is located.'
+
+ argument :maven_duplicates_allowed,
+ GraphQL::BOOLEAN_TYPE,
+ required: false,
+ description: copy_field_description(Types::Namespace::PackageSettingsType, :maven_duplicates_allowed)
+
+ argument :maven_duplicate_exception_regex,
+ Types::UntrustedRegexp,
+ required: false,
+ description: copy_field_description(Types::Namespace::PackageSettingsType, :maven_duplicate_exception_regex)
+
+ field :package_settings,
+ Types::Namespace::PackageSettingsType,
+ null: true,
+ description: 'The namespace package setting after mutation.'
+
+ def resolve(namespace_path:, **args)
+ namespace = authorized_find!(namespace_path: namespace_path)
+
+ result = ::Namespaces::PackageSettings::UpdateService
+ .new(container: namespace, current_user: current_user, params: args)
+ .execute
+
+ {
+ package_settings: result.payload[:package_settings],
+ errors: result.errors
+ }
+ end
+
+ private
+
+ def find_object(namespace_path:)
+ resolve_namespace(full_path: namespace_path)
+ end
+ end
+ end
+ end
+end