blob: 2ff9791feb0b81dd0912c6fbde90f26f3e207bdd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
class MilestoneNote < SyntheticNote
attr_accessor :milestone
def self.from_event(event, resource: nil, resource_parent: nil)
attrs = note_attributes('milestone', event, resource, resource_parent).merge(milestone: event.milestone)
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
milestone.nil? ? 'removed milestone' : "changed milestone to #{milestone.to_reference(project, format: format)}"
end
end
|