Welcome to mirror list, hosted at ThFree Co, Russian Federation.

post_process_service.rb « notes « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 45d916800f621d627392ea914935e415c73e67d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module Notes
  class PostProcessService
    attr_accessor :note

    def initialize(note)
      @note = note
    end

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

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

    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
  end
end