diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-19 18:10:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-19 18:10:53 +0300 |
commit | 8f3a9dbb94b5a9ae4570a22bbc2a75e7572407c8 (patch) | |
tree | 0d7e5d6d5747b57a93df1181bd86a7a127c16934 /app/graphql | |
parent | 7344cec8c24f1599086498ba19096cf9918ee168 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql')
-rw-r--r-- | app/graphql/mutations/work_items/update_task.rb | 70 | ||||
-rw-r--r-- | app/graphql/types/mutation_type.rb | 1 | ||||
-rw-r--r-- | app/graphql/types/work_items/updated_task_input_type.rb | 11 |
3 files changed, 0 insertions, 82 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 diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index 51ab6880b1a..94bb3055bc4 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -191,7 +191,6 @@ module Types mount_mutation Mutations::WorkItems::CreateFromTask, alpha: { milestone: '15.1' } mount_mutation Mutations::WorkItems::Delete, alpha: { milestone: '15.1' } mount_mutation Mutations::WorkItems::Update, alpha: { milestone: '15.1' } - mount_mutation Mutations::WorkItems::UpdateTask, alpha: { milestone: '15.1' } mount_mutation Mutations::WorkItems::Export, alpha: { milestone: '15.10' } mount_mutation Mutations::WorkItems::Convert, alpha: { milestone: '15.11' } mount_mutation Mutations::WorkItems::LinkedItems::Add, alpha: { milestone: '16.3' } diff --git a/app/graphql/types/work_items/updated_task_input_type.rb b/app/graphql/types/work_items/updated_task_input_type.rb deleted file mode 100644 index 9f8afa2ff1b..00000000000 --- a/app/graphql/types/work_items/updated_task_input_type.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module Types - module WorkItems - class UpdatedTaskInputType < BaseInputObject - graphql_name 'WorkItemUpdatedTaskInput' - - include Mutations::WorkItems::UpdateArguments - end - end -end |