diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-10-31 19:16:11 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-10-31 19:16:11 +0300 |
commit | 96c9981140049e18779d78711e0abcd6a04411f9 (patch) | |
tree | 4d48c7dc89cfe1b8aa41236d763f898621f88351 | |
parent | ed816c3d996ea65abf4b8d6600a5988903b61b2d (diff) | |
parent | 93d0bacfe5eca0099a6681f21363f5da683b7f04 (diff) |
Merge branch 'remove-ee-specific-code-from-plan-and-create-models' into 'master'
Remove EE-specific code from 'Discussion' models
See merge request gitlab-org/gitlab-ce!22687
-rw-r--r-- | app/models/concerns/noteable.rb | 2 | ||||
-rw-r--r-- | app/models/diff_note.rb | 6 | ||||
-rw-r--r-- | app/models/discussion_note.rb | 6 |
3 files changed, 9 insertions, 5 deletions
diff --git a/app/models/concerns/noteable.rb b/app/models/concerns/noteable.rb index 098eed137ba..eb315058c3a 100644 --- a/app/models/concerns/noteable.rb +++ b/app/models/concerns/noteable.rb @@ -23,7 +23,7 @@ module Noteable end def supports_discussions? - DiscussionNote::NOTEABLE_TYPES.include?(base_class_name) + DiscussionNote.noteable_types.include?(base_class_name) end def discussions_rendered_on_frontend? diff --git a/app/models/diff_note.rb b/app/models/diff_note.rb index 95694377fe3..5f59e4832db 100644 --- a/app/models/diff_note.rb +++ b/app/models/diff_note.rb @@ -8,12 +8,14 @@ class DiffNote < Note include DiffPositionableNote include Gitlab::Utils::StrongMemoize - NOTEABLE_TYPES = %w(MergeRequest Commit).freeze + def self.noteable_types + %w(MergeRequest Commit) + end validates :original_position, presence: true validates :position, presence: true validates :line_code, presence: true, line_code: true, if: :on_text? - validates :noteable_type, inclusion: { in: NOTEABLE_TYPES } + validates :noteable_type, inclusion: { in: noteable_types } validate :positions_complete validate :verify_supported validate :diff_refs_match_commit, if: :for_commit? diff --git a/app/models/discussion_note.rb b/app/models/discussion_note.rb index 89d86aaed66..142cbdcdfa6 100644 --- a/app/models/discussion_note.rb +++ b/app/models/discussion_note.rb @@ -5,9 +5,11 @@ # A note of this type can be resolvable. class DiscussionNote < Note # Names of all implementers of `Noteable` that support discussions. - NOTEABLE_TYPES = %w(MergeRequest Issue Commit Snippet).freeze + def self.noteable_types + %w(MergeRequest Issue Commit Snippet) + end - validates :noteable_type, inclusion: { in: NOTEABLE_TYPES } + validates :noteable_type, inclusion: { in: noteable_types } def discussion_class(*) Discussion |