BigW Consortium Gitlab

legacy_diff_discussion.rb 858 Bytes
Newer Older
Douwe Maan committed
1
# A discussion on merge request or commit diffs consisting of `LegacyDiffNote` notes.
2
#
Douwe Maan committed
3 4
# All new diff discussions are of the type `DiffDiscussion`, but any diff discussions created
# before the introduction of the new implementation still use `LegacyDiffDiscussion`.
5 6
#
# A discussion of this type is never resolvable.
7 8
class LegacyDiffDiscussion < Discussion
  include DiscussionOnDiff
9

Douwe Maan committed
10 11
  memoized_values << :active

12 13
  def self.note_class
    LegacyDiffNote
14 15
  end

16 17 18 19
  def legacy_diff_discussion?
    true
  end

Douwe Maan committed
20 21 22 23 24 25
  def active?(*args)
    return @active if @active.present?

    @active = first_note.active?(*args)
  end

26 27 28
  def collapsed?
    !active?
  end
29

30 31 32 33 34 35 36 37 38 39
  def merge_request_version_params
    return unless for_merge_request?

    if active?
      {}
    else
      nil
    end
  end

40 41 42
  def reply_attributes
    super.merge(line_code: line_code)
  end
43
end