Class: Mutations::Notes::RepositionImageDiffNote

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

Overview

This mutation differs from the update note mutations as it checks the ‘reposition_note` permission, and doesn’t allow updating a note’s ‘body`.

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(note:, position:) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/graphql/mutations/notes/reposition_image_diff_note.rb', line 26

def resolve(note:, position:)
  authorize!(note)

  position = position.to_h.compact
  pre_update_checks!(note, position)

  updated_note = ::Notes::UpdateService.new(
    note.project,
    current_user,
    note_params(note.position, position)
  ).execute(note)

  {
    note: updated_note.reset,
    errors: errors_on_object(updated_note)
  }
end