diff options
Diffstat (limited to 'app/models/legacy_diff_discussion.rb')
-rw-r--r-- | app/models/legacy_diff_discussion.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/models/legacy_diff_discussion.rb b/app/models/legacy_diff_discussion.rb new file mode 100644 index 00000000000..3c1d34db5fa --- /dev/null +++ b/app/models/legacy_diff_discussion.rb @@ -0,0 +1,43 @@ +# A discussion on merge request or commit diffs consisting of `LegacyDiffNote` notes. +# +# 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 + + memoized_values << :active + + def self.note_class + LegacyDiffNote + end + + def legacy_diff_discussion? + true + end + + 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 |