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

44 lines
858 B
Ruby
Raw Normal View History

2017-04-04 18:27:23 -04:00
# A discussion on merge request or commit diffs consisting of `LegacyDiffNote` notes.
#
2017-04-04 18:27:23 -04:00
# All new diff discussions are of the type `DiffDiscussion`, but any diff discussions created
# before the introduction of the new implementation still use `LegacyDiffDiscussion`.
#
# A discussion of this type is never resolvable.
class LegacyDiffDiscussion < Discussion
include DiscussionOnDiff
2017-04-08 15:58:08 -04:00
memoized_values << :active
def self.note_class
LegacyDiffNote
end
def legacy_diff_discussion?
true
end
2017-04-08 15:58:08 -04:00
def active?(*args)
return @active if @active.present?
@active = first_note.active?(*args)
end
def collapsed?
!active?
end
def merge_request_version_params
return unless for_merge_request?
if active?
{}
else
nil
end
end
def reply_attributes
super.merge(line_code: line_code)
end
end