Class: IndividualNoteDiscussion

Inherits:
Discussion show all
Defined in:
app/models/individual_note_discussion.rb

Overview

A discussion to wrap a single `Note` note on the root of an issue, merge request, commit, or snippet, that is not displayed as a discussion.

A discussion of this type is never resolvable.

Instance Attribute Summary

Attributes inherited from Discussion

#context_noteable, #notes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Discussion

#==, base_discussion_id, build, build_collection, build_discussion_id, #collapsed?, #declarative_policy_delegate, #diff_discussion?, discussion_id, #expanded?, #id, #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


8
9
10
# File 'app/models/individual_note_discussion.rb', line 8

def self.note_class
  Note
end

Instance Method Details

#can_convert_to_discussion?Boolean

Returns:

  • (Boolean)

16
17
18
# File 'app/models/individual_note_discussion.rb', line 16

def can_convert_to_discussion?
  noteable.supports_replying_to_individual_notes?
end

#convert_to_discussion!Object


20
21
22
# File 'app/models/individual_note_discussion.rb', line 20

def convert_to_discussion!
  first_note.becomes!(Discussion.note_class).to_discussion
end

#individual_note?Boolean

Returns:

  • (Boolean)

12
13
14
# File 'app/models/individual_note_discussion.rb', line 12

def individual_note?
  true
end

#reply_attributesObject


24
25
26
# File 'app/models/individual_note_discussion.rb', line 24

def reply_attributes
  super.tap { |attrs| attrs.delete(:discussion_id) }
end