Class: Mutations::IncidentManagement::TimelineEvent::PromoteFromNote

Inherits:
Base
  • Object
show all
Includes:
NotesHelper
Defined in:
app/graphql/mutations/incident_management/timeline_event/promote_from_note.rb

Constant Summary

Constants included from NotesHelper

NotesHelper::MAX_PRERENDERED_NOTES

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 NotesHelper

#add_diff_note_button, #can_create_note?, #diff_view_data, #diff_view_line_data, #discussion_path, #discussion_resolved_intro, #discussions_path, #form_resources, #initial_notes_data, #link_to_reply_discussion, #new_form_url, #note_human_max_access, #note_max_access_for_user, #note_supports_quick_actions?, #note_target_fields, #note_target_title, #note_url, #noteable_json, #noteable_note_url, #notes_data, #notes_url, #rendered_for_merge_request?, #serialize_notes?

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

#authorized_find!, #authorized_resource?, #raise_resource_not_available_error!

Instance Method Details

#resolve(note_id:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/graphql/mutations/incident_management/timeline_event/promote_from_note.rb', line 15

def resolve(note_id:)
  note = find_object(id: note_id)
  incident = note&.noteable

  authorize!(incident)

  response ::IncidentManagement::TimelineEvents::CreateService.new(
    incident,
    current_user,
    promoted_from_note: note,
    note: build_note_string(note),
    occurred_at: note.created_at,
    editable: true
  ).execute
end