summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/concerns/mutations
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/concerns/mutations')
-rw-r--r--app/graphql/mutations/concerns/mutations/authorizes_project.rb17
-rw-r--r--app/graphql/mutations/concerns/mutations/finds_project.rb11
-rw-r--r--app/graphql/mutations/concerns/mutations/resolves_namespace.rb15
-rw-r--r--app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb4
-rw-r--r--app/graphql/mutations/concerns/mutations/resolves_subscription.rb2
-rw-r--r--app/graphql/mutations/concerns/mutations/spammable_mutation_fields.rb2
6 files changed, 30 insertions, 21 deletions
diff --git a/app/graphql/mutations/concerns/mutations/authorizes_project.rb b/app/graphql/mutations/concerns/mutations/authorizes_project.rb
deleted file mode 100644
index 87341525d6c..00000000000
--- a/app/graphql/mutations/concerns/mutations/authorizes_project.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-module Mutations
- module AuthorizesProject
- include ResolvesProject
-
- def authorized_find_project!(full_path:)
- authorized_find!(full_path: full_path)
- end
-
- private
-
- def find_object(full_path:)
- resolve_project(full_path: full_path)
- end
- end
-end
diff --git a/app/graphql/mutations/concerns/mutations/finds_project.rb b/app/graphql/mutations/concerns/mutations/finds_project.rb
new file mode 100644
index 00000000000..577f9dc90f8
--- /dev/null
+++ b/app/graphql/mutations/concerns/mutations/finds_project.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module Mutations
+ module FindsProject
+ private
+
+ def find_object(full_path)
+ Project.find_by_full_path(full_path)
+ end
+ end
+end
diff --git a/app/graphql/mutations/concerns/mutations/resolves_namespace.rb b/app/graphql/mutations/concerns/mutations/resolves_namespace.rb
new file mode 100644
index 00000000000..35009623c69
--- /dev/null
+++ b/app/graphql/mutations/concerns/mutations/resolves_namespace.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Mutations
+ module ResolvesNamespace
+ extend ActiveSupport::Concern
+
+ def resolve_namespace(full_path:)
+ namespace_resolver.resolve(full_path: full_path)
+ end
+
+ def namespace_resolver
+ Resolvers::NamespaceResolver.new(object: nil, context: context, field: nil)
+ end
+ end
+end
diff --git a/app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb b/app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb
index 04a9abf9529..e2b3f4b046f 100644
--- a/app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb
+++ b/app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb
@@ -9,11 +9,11 @@ module Mutations
included do
argument :project_path, GraphQL::ID_TYPE,
required: false,
- description: 'The project full path the resource is associated with'
+ description: 'The project full path the resource is associated with.'
argument :group_path, GraphQL::ID_TYPE,
required: false,
- description: 'The group full path the resource is associated with'
+ description: 'The group full path the resource is associated with.'
end
def ready?(**args)
diff --git a/app/graphql/mutations/concerns/mutations/resolves_subscription.rb b/app/graphql/mutations/concerns/mutations/resolves_subscription.rb
index e8c5d0d404d..e26ae7d228c 100644
--- a/app/graphql/mutations/concerns/mutations/resolves_subscription.rb
+++ b/app/graphql/mutations/concerns/mutations/resolves_subscription.rb
@@ -7,7 +7,7 @@ module Mutations
argument :subscribed_state,
GraphQL::BOOLEAN_TYPE,
required: true,
- description: 'The desired state of the subscription'
+ description: 'The desired state of the subscription.'
end
def resolve(project_path:, iid:, subscribed_state:)
diff --git a/app/graphql/mutations/concerns/mutations/spammable_mutation_fields.rb b/app/graphql/mutations/concerns/mutations/spammable_mutation_fields.rb
index 7aef55f8011..e5df8565618 100644
--- a/app/graphql/mutations/concerns/mutations/spammable_mutation_fields.rb
+++ b/app/graphql/mutations/concerns/mutations/spammable_mutation_fields.rb
@@ -8,7 +8,7 @@ module Mutations
field :spam,
GraphQL::BOOLEAN_TYPE,
null: true,
- description: 'Indicates whether the operation returns a record detected as spam'
+ description: 'Indicates whether the operation returns a record detected as spam.'
end
def with_spam_params(&block)