2017-04-04 18:27:23 -04:00
|
|
|
# A discussion on merge request or commit diffs consisting of `LegacyDiffNote` notes.
|
2017-04-06 11:05:57 -04:00
|
|
|
#
|
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`.
|
2017-04-06 11:05:57 -04:00
|
|
|
#
|
|
|
|
# A discussion of this type is never resolvable.
|
2017-03-30 20:38:21 -04:00
|
|
|
class LegacyDiffDiscussion < Discussion
|
|
|
|
include DiscussionOnDiff
|
2017-03-09 20:29:11 -05:00
|
|
|
|
2017-04-08 15:58:08 -04:00
|
|
|
memoized_values << :active
|
|
|
|
|
2017-04-06 11:05:57 -04:00
|
|
|
def self.note_class
|
|
|
|
LegacyDiffNote
|
2017-03-09 20:29:11 -05:00
|
|
|
end
|
|
|
|
|
2017-04-30 16:32:09 -04:00
|
|
|
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
|
|
|
|
|
2017-03-09 20:29:11 -05:00
|
|
|
def collapsed?
|
|
|
|
!active?
|
|
|
|
end
|
2017-03-30 20:38:21 -04:00
|
|
|
|
2017-04-30 16:32:09 -04:00
|
|
|
def merge_request_version_params
|
|
|
|
return unless for_merge_request?
|
|
|
|
|
|
|
|
if active?
|
|
|
|
{}
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-30 20:38:21 -04:00
|
|
|
def reply_attributes
|
|
|
|
super.merge(line_code: line_code)
|
|
|
|
end
|
2017-03-09 20:29:11 -05:00
|
|
|
end
|