debian-mirror-gitlab/app/graphql/mutations/issues/update.rb

46 lines
1.4 KiB
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
module Mutations
module Issues
class Update < Base
graphql_name 'UpdateIssue'
2021-01-03 14:25:43 +05:30
include CommonMutationArguments
2020-04-08 14:13:33 +05:30
2021-01-03 14:25:43 +05:30
argument :title, GraphQL::STRING_TYPE,
2020-04-08 14:13:33 +05:30
required: false,
2021-01-03 14:25:43 +05:30
description: copy_field_description(Types::IssueType, :title)
2020-03-13 15:44:24 +05:30
2021-02-22 17:27:13 +05:30
argument :milestone_id, GraphQL::ID_TYPE, # rubocop: disable Graphql/IDType
2020-10-24 23:57:45 +05:30
required: false,
2021-01-03 14:25:43 +05:30
description: 'The ID of the milestone to assign to the issue. On update milestone will be removed if set to null'
2020-10-24 23:57:45 +05:30
2021-01-03 14:25:43 +05:30
argument :add_label_ids, [GraphQL::ID_TYPE],
2020-10-24 23:57:45 +05:30
required: false,
2021-01-03 14:25:43 +05:30
description: 'The IDs of labels to be added to the issue'
2020-10-24 23:57:45 +05:30
2021-01-03 14:25:43 +05:30
argument :remove_label_ids, [GraphQL::ID_TYPE],
2020-10-24 23:57:45 +05:30
required: false,
2021-01-03 14:25:43 +05:30
description: 'The IDs of labels to be removed from the issue'
2020-10-24 23:57:45 +05:30
2021-01-03 14:25:43 +05:30
argument :state_event, Types::IssueStateEventEnum,
description: 'Close or reopen an issue',
required: false
2020-10-24 23:57:45 +05:30
2020-03-13 15:44:24 +05:30
def resolve(project_path:, iid:, **args)
issue = authorized_find!(project_path: project_path, iid: iid)
project = issue.project
::Issues::UpdateService.new(project, current_user, args).execute(issue)
{
issue: issue,
2020-06-23 00:09:42 +05:30
errors: errors_on_object(issue)
2020-03-13 15:44:24 +05:30
}
end
end
end
end
Mutations::Issues::Update.prepend_if_ee('::EE::Mutations::Issues::Update')