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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.4 KiB
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
module Mutations
module MergeRequests
class Update < Base
graphql_name 'MergeRequestUpdate'
description 'Update attributes of a merge request'
2021-10-27 15:23:28 +05:30
argument :title, GraphQL::Types::String,
2020-07-28 23:09:34 +05:30
required: false,
description: copy_field_description(Types::MergeRequestType, :title)
2021-10-27 15:23:28 +05:30
argument :target_branch, GraphQL::Types::String,
2020-07-28 23:09:34 +05:30
required: false,
description: copy_field_description(Types::MergeRequestType, :target_branch)
2021-10-27 15:23:28 +05:30
argument :description, GraphQL::Types::String,
2020-07-28 23:09:34 +05:30
required: false,
description: copy_field_description(Types::MergeRequestType, :description)
2021-03-11 19:13:27 +05:30
argument :state, ::Types::MergeRequestStateEventEnum,
required: false,
as: :state_event,
2021-10-27 15:23:28 +05:30
description: 'Action to perform to change the state.'
2021-03-11 19:13:27 +05:30
def resolve(project_path:, iid:, **args)
merge_request = authorized_find!(project_path: project_path, iid: iid)
attributes = args.compact
2020-07-28 23:09:34 +05:30
::MergeRequests::UpdateService
2021-06-08 01:23:25 +05:30
.new(project: merge_request.project, current_user: current_user, params: attributes)
2020-07-28 23:09:34 +05:30
.execute(merge_request)
errors = errors_on_object(merge_request)
{
merge_request: merge_request.reset,
errors: errors
}
end
end
end
end