debian-mirror-gitlab/app/services/system_notes/base_service.rb

31 lines
701 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05: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)
2021-06-08 01:23:25 +05:30
note_params = note_summary.note.merge(system: true)
note_params[:system_note_metadata] = SystemNoteMetadata.new(note_summary.metadata) if note_summary.metadata?
2019-12-21 20:55:43 +05:30
2021-06-08 01:23:25 +05:30
Note.create(note_params)
2019-12-21 20:55:43 +05:30
end
2023-04-23 21:23:45 +05:30
def content_tag(...)
ActionController::Base.helpers.content_tag(...)
2019-12-21 20:55:43 +05:30
end
def url_helpers
@url_helpers ||= Gitlab::Routing.url_helpers
end
end
end