debian-mirror-gitlab/app/models/milestone_note.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
700 B
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
2020-04-22 19:07:51 +05:30
class MilestoneNote < SyntheticNote
attr_accessor :milestone
2020-04-08 14:13:33 +05:30
def self.from_event(event, resource: nil, resource_parent: nil)
2020-04-22 19:07:51 +05:30
attrs = note_attributes('milestone', event, resource, resource_parent).merge(milestone: event.milestone)
2020-04-08 14:13:33 +05:30
MilestoneNote.new(attrs)
end
def note_html
@note_html ||= Banzai::Renderer.cacheless_render_field(self, :note, { group: group, project: project })
end
private
def note_text(html: false)
format = milestone&.group_milestone? ? :name : :iid
2023-06-20 00:43:36 +05:30
reference = milestone&.to_reference(project, format: format)
event.remove? ? "removed milestone #{reference}" : "changed milestone to #{reference}"
2020-04-08 14:13:33 +05:30
end
end