summaryrefslogtreecommitdiff
path: root/lib/api/notes.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2019-02-21 14:34:40 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2019-03-04 17:44:56 +0100
commit654c4dd9224dc941c073b44730a6461e5d06edfc (patch)
tree130deb16c0f6a767ba51448767e0d1a5244ef9e2 /lib/api/notes.rb
parentc01e93249da72cf91f3516da6bb48d8989335508 (diff)
downloadgitlab-ce-654c4dd9224dc941c073b44730a6461e5d06edfc.tar.gz
Refactor API noteable types constants
This replaces API::Notes::NOTEABLE_TYPES and API::Discussions::NOTEABLE_TYPES with class methods defined in a separate helper modules. This allows EE to extend the list of noteable types, without having to modify the constant in-place. We can't define these methods directly in the API classes, as they would be used before we're able to extend them in EE.
Diffstat (limited to 'lib/api/notes.rb')
-rw-r--r--lib/api/notes.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb
index f7bd092ce50..416cf39d3ec 100644
--- a/lib/api/notes.rb
+++ b/lib/api/notes.rb
@@ -7,9 +7,7 @@ module API
before { authenticate! }
- NOTEABLE_TYPES = [Issue, MergeRequest, Snippet].freeze
-
- NOTEABLE_TYPES.each do |noteable_type|
+ Helpers::NotesHelpers.noteable_types.each do |noteable_type|
parent_type = noteable_type.parent_class.to_s.underscore
noteables_str = noteable_type.to_s.underscore.pluralize