2021-01-03 14:25:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Issues
|
|
|
|
class Move < Base
|
|
|
|
graphql_name 'IssueMove'
|
|
|
|
|
|
|
|
argument :target_project_path,
|
2021-10-27 15:23:28 +05:30
|
|
|
GraphQL::Types::ID,
|
2021-01-03 14:25:43 +05:30
|
|
|
required: true,
|
2021-10-27 15:23:28 +05:30
|
|
|
description: 'Project to move the issue to.'
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
def resolve(project_path:, iid:, target_project_path:)
|
2021-04-29 21:17:54 +05:30
|
|
|
Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/20816')
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
issue = authorized_find!(project_path: project_path, iid: iid)
|
|
|
|
source_project = issue.project
|
|
|
|
target_project = resolve_project(full_path: target_project_path).sync
|
|
|
|
|
|
|
|
begin
|
2021-06-08 01:23:25 +05:30
|
|
|
moved_issue = ::Issues::MoveService.new(project: source_project, current_user: current_user).execute(issue, target_project)
|
2022-08-27 11:52:29 +05:30
|
|
|
rescue ::Issues::MoveService::MoveError => e
|
|
|
|
errors = e.message
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
{
|
|
|
|
issue: moved_issue,
|
|
|
|
errors: Array.wrap(errors)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|