Class: Mutations::MergeRequests::Update

Inherits:
Base
  • Object
show all
Includes:
ValidateTimeEstimate
Defined in:
app/graphql/mutations/merge_requests/update.rb

Constant Summary

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods included from ResolvesIssuable

#resolve_issuable

Methods inherited from BaseMutation

#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #unauthorized_object

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!

Instance Method Details

#ready?(time_estimate: nil, **args) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
53
54
# File 'app/graphql/mutations/merge_requests/update.rb', line 50

def ready?(time_estimate: nil, **args)
  validate_time_estimate(time_estimate)

  super
end

#resolve(project_path:, iid:, **args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/graphql/mutations/merge_requests/update.rb', line 34

def resolve(project_path:, iid:, **args)
  merge_request = authorized_find!(project_path: project_path, iid: iid)
  args = parse_arguments(args)

  ::MergeRequests::UpdateService
    .new(project: merge_request.project, current_user: current_user, params: args)
    .execute(merge_request)

  errors = errors_on_object(merge_request)

  {
    merge_request: merge_request.reset,
    errors: errors
  }
end