BigW Consortium Gitlab

out_of_context_discussion.rb 790 Bytes
Newer Older
1 2 3
# When notes on a commit are displayed in the context of a merge request that
# contains that commit, they are displayed as if they were a discussion.
#
Douwe Maan committed
4
# This represents one of those discussions, consisting of `Note` notes.
5 6
#
# A discussion of this type is never resolvable.
Douwe Maan committed
7
class OutOfContextDiscussion < Discussion
Douwe Maan committed
8 9 10 11 12 13
  # Returns an array of discussion ID components
  def self.build_discussion_id(note)
    base_discussion_id(note)
  end

  # To make sure all out-of-context notes end up grouped as one discussion,
Douwe Maan committed
14 15
  # we override the discussion ID to be a newly generated but consistent ID.
  def self.override_discussion_id(note)
Douwe Maan committed
16
    discussion_id(note)
Douwe Maan committed
17
  end
18

19 20
  def self.note_class
    Note
Douwe Maan committed
21
  end
22 23 24 25

  def reply_attributes
    super.tap { |attrs| attrs.delete(:discussion_id) }
  end
Douwe Maan committed
26
end