Class: Mutations::Notes::Create::Base

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

Overview

This is a Base class for the Note creation Mutations and is not mounted as a GraphQL mutation itself.

Direct Known Subclasses

DiffNote, ImageDiffNote, Note

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 BaseMutation

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

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

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

Instance Method Details

#resolve(args) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/graphql/mutations/notes/create/base.rb', line 32

def resolve(args)
  noteable = authorized_find!(id: args[:noteable_id])
  verify_rate_limit!(current_user)

  note = ::Notes::CreateService.new(
    noteable.project,
    current_user,
    create_note_params(noteable, args)
  ).execute

  {
    note: (note if note.persisted?),
    errors: errors_on_object(note)
  }
end