summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2019-02-26 17:07:32 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2019-03-04 17:44:56 +0100
commit6c9e26a2a0abcf5a7fdff027688e0c5204afed9e (patch)
tree98550d0dff48e4c53809bc599c43ec033ec49bf5 /lib
parent6402880c70f88f4c37a825d09f19221ad1797e4b (diff)
downloadgitlab-ce-6c9e26a2a0abcf5a7fdff027688e0c5204afed9e.tar.gz
Move eventable types constant to a helper
This moves API::ResourceLabelEventsHelpers::EVENTABLE_TYPES to a class method in a separate helper module, allowing EE to redefine it without having to directly modify the source code.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/helpers/resource_label_events_helpers.rb13
-rw-r--r--lib/api/resource_label_events.rb4
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/api/helpers/resource_label_events_helpers.rb b/lib/api/helpers/resource_label_events_helpers.rb
new file mode 100644
index 00000000000..23574deb59b
--- /dev/null
+++ b/lib/api/helpers/resource_label_events_helpers.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module API
+ module Helpers
+ module ResourceLabelEventsHelpers
+ def self.eventable_types
+ # This is a method instead of a constant, allowing EE to more easily
+ # extend it.
+ [Issue, MergeRequest]
+ end
+ end
+ end
+end
diff --git a/lib/api/resource_label_events.rb b/lib/api/resource_label_events.rb
index 0c328f7268e..448bef12cec 100644
--- a/lib/api/resource_label_events.rb
+++ b/lib/api/resource_label_events.rb
@@ -7,9 +7,7 @@ module API
before { authenticate! }
- EVENTABLE_TYPES = [Issue, MergeRequest].freeze
-
- EVENTABLE_TYPES.each do |eventable_type|
+ Helpers::ResourceLabelEventsHelpers.eventable_types.each do |eventable_type|
parent_type = eventable_type.parent_class.to_s.underscore
eventables_str = eventable_type.to_s.underscore.pluralize