Class: Mutations::Notes::Create::DiffNote

Inherits:
Base
  • Object
show all
Defined in:
app/graphql/mutations/notes/create/diff_note.rb

Constant Summary

Constants inherited from Base

Base::QUICK_ACTION_ONLY_WARNING

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 inherited from Base

#resolve

Methods inherited from BaseMutation

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

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

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

Methods included from Gitlab::Graphql::GlobalIDCompatibility

#coerce_global_id_arguments!

Instance Method Details

#ready?(**args) ⇒ Boolean

Returns:

  • (Boolean)

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/graphql/mutations/notes/create/diff_note.rb', line 14

def ready?(**args)
  # As both arguments are optional, validate here that one of the
  # arguments are present.
  #
  # This may be able to be done using InputUnions in the future
  # if this RFC is merged:
  # https://github.com/graphql/graphql-spec/blob/master/rfcs/InputUnion.md

  if args[:position].to_hash.values_at(:old_line, :new_line).compact.blank?
    raise Gitlab::Graphql::Errors::ArgumentError,
          'position oldLine or newLine arguments are required'
  end

  super(**args)
end