diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 15:07:53 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 15:07:53 +0000 |
commit | d7a028e20d29b8c6d0e780ac168544dfbb712d3c (patch) | |
tree | f9fc9ea12e166aec6c4ffe476ba7a3566396b696 /app/models/label_note.rb | |
parent | 0d0cddc9ce20c5a7d8a2723d0aa620ca184a711a (diff) | |
download | gitlab-ce-d7a028e20d29b8c6d0e780ac168544dfbb712d3c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/label_note.rb')
-rw-r--r-- | app/models/label_note.rb | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/app/models/label_note.rb b/app/models/label_note.rb index 13a2e1b0c72..e90028ce835 100644 --- a/app/models/label_note.rb +++ b/app/models/label_note.rb @@ -1,26 +1,13 @@ # frozen_string_literal: true -class LabelNote < Note +class LabelNote < SyntheticNote attr_accessor :resource_parent attr_reader :events def self.from_events(events, resource: nil, resource_parent: nil) resource ||= events.first.issuable - attrs = { - system: true, - author: events.first.user, - created_at: events.first.created_at, - discussion_id: events.first.discussion_id, - noteable: resource, - system_note_metadata: SystemNoteMetadata.new(action: 'label'), - events: events, - resource_parent: resource_parent - } - - if resource_parent.is_a?(Project) - attrs[:project_id] = resource_parent.id - end + attrs = note_attributes('label', events.first, resource, resource_parent).merge(events: events) LabelNote.new(attrs) end @@ -35,22 +22,10 @@ class LabelNote < Note true end - def note - @note ||= note_text - end - def note_html @note_html ||= "<p dir=\"auto\">#{note_text(html: true)}</p>" end - def project - resource_parent if resource_parent.is_a?(Project) - end - - def group - resource_parent if resource_parent.is_a?(Group) - end - private def update_outdated_markdown |