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/update_task.rb')
-rw-r--r--app/graphql/mutations/work_items/update_task.rb70
1 files changed, 0 insertions, 70 deletions
diff --git a/app/graphql/mutations/work_items/update_task.rb b/app/graphql/mutations/work_items/update_task.rb
deleted file mode 100644
index d3df235f894..00000000000
--- a/app/graphql/mutations/work_items/update_task.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-# frozen_string_literal: true
-
-module Mutations
- module WorkItems
- class UpdateTask < BaseMutation
- graphql_name 'WorkItemUpdateTask'
- description "Updates a work item's task by Global ID."
-
- include Mutations::SpamProtection
-
- authorize :read_work_item
-
- argument :id, ::Types::GlobalIDType[::WorkItem],
- required: true,
- description: 'Global ID of the work item.'
- argument :task_data, ::Types::WorkItems::UpdatedTaskInputType,
- required: true,
- description: 'Arguments necessary to update a task.'
-
- field :task, Types::WorkItemType,
- null: true,
- description: 'Updated task.'
- field :work_item, Types::WorkItemType,
- null: true,
- description: 'Updated work item.'
-
- def resolve(id:, task_data:)
- task_data_hash = task_data.to_h
- work_item = authorized_find!(id: id)
- task = authorized_find_task!(task_data_hash[:id])
-
- ::WorkItems::UpdateService.new(
- container: task.project,
- current_user: current_user,
- params: task_data_hash.except(:id),
- perform_spam_check: true
- ).execute(task)
-
- check_spam_action_response!(task)
-
- response = { errors: errors_on_object(task) }
-
- if task.valid?
- work_item.expire_etag_cache
-
- response.merge(work_item: work_item, task: task)
- else
- response
- end
- end
-
- private
-
- def authorized_find_task!(task_id)
- task = task_id.find
-
- if current_user.can?(:update_work_item, task)
- task
- else
- # Fail early if user cannot update task
- raise_resource_not_available_error!
- end
- end
-
- def find_object(id:)
- id.find
- end
- end
- end
-end