summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/issues/create.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/issues/create.rb')
-rw-r--r--app/graphql/mutations/issues/create.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/app/graphql/mutations/issues/create.rb b/app/graphql/mutations/issues/create.rb
index 72b03cc27c2..6bf8caf82d7 100644
--- a/app/graphql/mutations/issues/create.rb
+++ b/app/graphql/mutations/issues/create.rb
@@ -3,12 +3,12 @@
module Mutations
module Issues
class Create < BaseMutation
+ graphql_name 'CreateIssue'
+
include Mutations::SpamProtection
include FindsProject
include CommonMutationArguments
- graphql_name 'CreateIssue'
-
authorize :create_issue
argument :project_path, GraphQL::Types::ID,
@@ -51,6 +51,14 @@ module Mutations
required: false,
description: 'Array of user IDs to assign to the issue.'
+ argument :move_before_id, ::Types::GlobalIDType[::Issue],
+ required: false,
+ description: 'Global ID of issue that should be placed before the current issue.'
+
+ argument :move_after_id, ::Types::GlobalIDType[::Issue],
+ required: false,
+ description: 'Global ID of issue that should be placed after the current issue.'
+
field :issue,
Types::IssueType,
null: true,
@@ -93,6 +101,13 @@ module Mutations
params[:assignee_ids] &&= params[:assignee_ids].map { |assignee_id| assignee_id&.model_id }
params[:label_ids] &&= params[:label_ids].map { |label_id| label_id&.model_id }
+ if params[:move_before_id].present? || params[:move_after_id].present?
+ params[:move_between_ids] = [
+ params.delete(:move_before_id)&.model_id,
+ params.delete(:move_after_id)&.model_id
+ ]
+ end
+
params
end