Class: DiffDiscussion

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

Overview

A discussion on merge request or commit diffs consisting of `DiffNote` notes.

A discussion of this type can be 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?, #collapsed?, #declarative_policy_delegate, #diff_discussion?, discussion_id, #expanded?, #id, #individual_note?, #initialize, #last_note, #last_updated_at, #last_updated_by, lazy_find, #on_image?, 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


9
10
11
# File 'app/models/diff_discussion.rb', line 9

def self.note_class
  DiffNote
end

Instance Method Details

#legacy_diff_discussion?Boolean

Returns:

  • (Boolean)

21
22
23
# File 'app/models/diff_discussion.rb', line 21

def legacy_diff_discussion?
  false
end

#merge_request_version_paramsObject


25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/diff_discussion.rb', line 25

def merge_request_version_params
  return unless for_merge_request?

  version_params = get_params

  return version_params unless on_merge_request_commit? && commit_id

  version_params ||= {}
  version_params.tap do |params|
    params[:commit_id] = commit_id
  end
end

#reply_attributesObject


38
39
40
41
42
43
# File 'app/models/diff_discussion.rb', line 38

def reply_attributes
  super.merge(
    original_position: original_position.to_json,
    position: position.to_json
  )
end