Class: Notes::PostProcessService

Inherits:
Object
  • Object
show all
Defined in:
app/services/notes/post_process_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(note) ⇒ PostProcessService

Returns a new instance of PostProcessService


5
6
7
# File 'app/services/notes/post_process_service.rb', line 5

def initialize(note)
  @note = note
end

Instance Attribute Details

#noteObject

Returns the value of attribute note


3
4
5
# File 'app/services/notes/post_process_service.rb', line 3

def note
  @note
end

Instance Method Details

#executeObject


9
10
11
12
13
14
15
16
# File 'app/services/notes/post_process_service.rb', line 9

def execute
  # Skip system notes, like status changes and cross-references and awards
  unless @note.system || @note.is_award
    EventCreateService.new.leave_note(@note, @note.author)
    @note.create_cross_references!
    execute_note_hooks
  end
end

#execute_note_hooksObject


22
23
24
25
26
# File 'app/services/notes/post_process_service.rb', line 22

def execute_note_hooks
  note_data = hook_data
  @note.project.execute_hooks(note_data, :note_hooks)
  @note.project.execute_services(note_data, :note_hooks)
end

#hook_dataObject


18
19
20
# File 'app/services/notes/post_process_service.rb', line 18

def hook_data
  Gitlab::NoteDataBuilder.build(@note, @note.author)
end