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

base_service.rb « system_notes « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7341a25b1339cdc0d3582b4febd89e8e98c97dc9 (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
# frozen_string_literal: true

module SystemNotes
  class BaseService
    attr_reader :noteable, :project, :author

    def initialize(noteable: nil, author: nil, project: nil)
      @noteable = noteable
      @project = project
      @author = author
    end

    protected

    def create_note(note_summary)
      note = Note.create(note_summary.note.merge(system: true))
      note.system_note_metadata = SystemNoteMetadata.new(note_summary.metadata) if note_summary.metadata?

      note
    end

    def content_tag(*args)
      ActionController::Base.helpers.content_tag(*args)
    end

    def url_helpers
      @url_helpers ||= Gitlab::Routing.url_helpers
    end
  end
end