Commit e82c6d05 authored by Yorick Peterse's avatar Yorick Peterse

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.
parent a4d4f419
# frozen_string_literal: true
module EE
module API
module Helpers
module ResourceLabelEventsHelpers
extend ActiveSupport::Concern
class_methods do
extend ::Gitlab::Utils::Override
override :eventable_types
def eventable_types
[::Epic, *super]
end
end
end
end
end
end
# 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
API::Helpers::ResourceLabelEventsHelpers.prepend(EE::API::Helpers::ResourceLabelEventsHelpers)
......@@ -7,9 +7,7 @@ module API
before { authenticate! }
EVENTABLE_TYPES = [Issue, Epic, 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment