Class: LegacyDiffDiscussion

Inherits:
Discussion show all
Includes:
DiscussionOnDiff
Defined in:
app/models/legacy_diff_discussion.rb

Overview

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.

Constant Summary

Constants included from DiscussionOnDiff

DiscussionOnDiff::NUMBER_OF_TRUNCATED_DIFF_LINES

Instance Attribute Summary

Attributes inherited from Discussion

#context_noteable, #notes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DiscussionOnDiff

#diff_discussion?, #diff_file, #file_new_path, #line_code_in_diffs, #on_merge_request_commit?, #truncated_diff_lines

Methods inherited from Discussion

#==, base_discussion_id, build, build_collection, build_discussion_id, #can_convert_to_discussion?, #declarative_policy_delegate, #diff_discussion?, discussion_id, #expanded?, #id, #individual_note?, #initialize, #last_note, #last_updated_at, #last_updated_by, lazy_find, override_discussion_id, #project_id, #reply_id, #updated?

Methods included from ResolvableDiscussion

#can_resolve?, #first_note, #first_note_to_resolve, #last_resolved_note, #resolvable?, #resolve!, #resolved?, #resolved_notes, #to_be_resolved?, #unresolve!

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

This class inherits a constructor from Discussion

Class Method Details

.note_classObject


14
15
16
# File 'app/models/legacy_diff_discussion.rb', line 14

def self.note_class
  LegacyDiffNote
end

Instance Method Details

#active?(*args) ⇒ Boolean

Returns:

  • (Boolean)

30
31
32
33
34
# File 'app/models/legacy_diff_discussion.rb', line 30

def active?(*args)
  return @active if @active.present?

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

#collapsed?Boolean

Returns:

  • (Boolean)

36
37
38
# File 'app/models/legacy_diff_discussion.rb', line 36

def collapsed?
  !active?
end

#legacy_diff_discussion?Boolean

Returns:

  • (Boolean)

18
19
20
# File 'app/models/legacy_diff_discussion.rb', line 18

def legacy_diff_discussion?
  true
end

#merge_request_version_paramsObject


40
41
42
43
44
45
46
47
48
# File 'app/models/legacy_diff_discussion.rb', line 40

def merge_request_version_params
  return unless for_merge_request?

  if active?
    {}
  else
    nil
  end
end

#on_image?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'app/models/legacy_diff_discussion.rb', line 22

def on_image?
  false
end

#on_text?Boolean

Returns:

  • (Boolean)

26
27
28
# File 'app/models/legacy_diff_discussion.rb', line 26

def on_text?
  true
end

#reply_attributesObject


50
51
52
# File 'app/models/legacy_diff_discussion.rb', line 50

def reply_attributes
  super.merge(line_code: line_code)
end