gitlab-org--gitlab-foss/app/models/individual_note_discussion.rb

28 lines
625 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-03-30 23:06:09 -04:00
# A discussion to wrap a single `Note` note on the root of an issue, merge request,
2017-04-04 18:27:23 -04:00
# commit, or snippet, that is not displayed as a discussion.
#
# A discussion of this type is never resolvable.
class IndividualNoteDiscussion < Discussion
def self.note_class
Note
end
2017-03-17 15:25:52 -04:00
def individual_note?
true
end
def can_convert_to_discussion?
noteable.supports_replying_to_individual_notes?
end
def convert_to_discussion!
first_note.becomes!(Discussion.note_class).to_discussion
end
def reply_attributes
super.tap { |attrs| attrs.delete(:discussion_id) }
end
end