Class: Mutations::Issues::Update

Inherits:
Base
  • Object
show all
Includes:
CommonMutationArguments, ValidateTimeEstimate
Defined in:
app/graphql/mutations/issues/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?(label_ids: [], add_label_ids: [], remove_label_ids: [], time_estimate: nil, **args) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
57
58
59
60
61
62
# File 'app/graphql/mutations/issues/update.rb', line 54

def ready?(label_ids: [], add_label_ids: [], remove_label_ids: [], time_estimate: nil, **args)
  if label_ids.any? && (add_label_ids.any? || remove_label_ids.any?)
    raise Gitlab::Graphql::Errors::ArgumentError, 'labelIds is mutually exclusive with any of addLabelIds or removeLabelIds'
  end

  validate_time_estimate(time_estimate)

  super
end

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



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'app/graphql/mutations/issues/update.rb', line 40

def resolve(project_path:, iid:, **args)
  issue = authorized_find!(project_path: project_path, iid: iid)
  project = issue.project

  args = parse_arguments(args)

  ::Issues::UpdateService.new(container: project, current_user: current_user, params: args, perform_spam_check: true).execute(issue)

  {
    issue: issue,
    errors: errors_on_object(issue)
  }
end