Commit 4103b304 authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Yorick Peterse

Replace prepend_entity with prepend_if_ee helper (EE-port)

parent 0d689420
......@@ -3,8 +3,15 @@
require 'active_support/inflector'
module InjectEnterpriseEditionModule
def prepend_if_ee(constant)
prepend(constant.constantize) if Gitlab.ee?
def prepend_if_ee(constant, with_descendants: false)
return unless Gitlab.ee?
ee_module = constant.constantize
prepend(ee_module)
if with_descendants
descendants.each { |descendant| descendant.prepend(ee_module) }
end
end
def extend_if_ee(constant)
......
......@@ -1708,19 +1708,20 @@ module API
end
end
API::Entities.prepend_if_ee('EE::API::Entities::Entities') # rubocop: disable Cop/InjectEnterpriseEditionModule
API::Entities.prepend_entity(::API::Entities::ApplicationSetting, with: EE::API::Entities::ApplicationSetting)
API::Entities.prepend_entity(::API::Entities::Board, with: EE::API::Entities::Board)
API::Entities.prepend_entity(::API::Entities::Group, with: EE::API::Entities::Group)
API::Entities.prepend_entity(::API::Entities::GroupDetail, with: EE::API::Entities::GroupDetail)
API::Entities.prepend_entity(::API::Entities::IssueBasic, with: EE::API::Entities::IssueBasic)
API::Entities.prepend_entity(::API::Entities::List, with: EE::API::Entities::List)
API::Entities.prepend_entity(::API::Entities::MergeRequestBasic, with: EE::API::Entities::MergeRequestBasic)
API::Entities.prepend_entity(::API::Entities::Namespace, with: EE::API::Entities::Namespace)
API::Entities.prepend_entity(::API::Entities::Project, with: EE::API::Entities::Project)
API::Entities.prepend_entity(::API::Entities::ProtectedRefAccess, with: EE::API::Entities::ProtectedRefAccess)
API::Entities.prepend_entity(::API::Entities::UserPublic, with: EE::API::Entities::UserPublic)
API::Entities.prepend_entity(::API::Entities::Todo, with: EE::API::Entities::Todo)
API::Entities.prepend_entity(::API::Entities::ProtectedBranch, with: EE::API::Entities::ProtectedBranch)
API::Entities.prepend_entity(::API::Entities::Identity, with: EE::API::Entities::Identity)
API::Entities.prepend_entity(::API::Entities::UserWithAdmin, with: EE::API::Entities::UserWithAdmin)
# rubocop: disable Cop/InjectEnterpriseEditionModule
API::Entities.prepend_if_ee('EE::API::Entities::Entities')
::API::Entities::ApplicationSetting.prepend_if_ee('EE::API::Entities::ApplicationSetting')
::API::Entities::Board.prepend_if_ee('EE::API::Entities::Board')
::API::Entities::Group.prepend_if_ee('EE::API::Entities::Group', with_descendants: true)
::API::Entities::GroupDetail.prepend_if_ee('EE::API::Entities::GroupDetail')
::API::Entities::IssueBasic.prepend_if_ee('EE::API::Entities::IssueBasic', with_descendants: true)
::API::Entities::List.prepend_if_ee('EE::API::Entities::List')
::API::Entities::MergeRequestBasic.prepend_if_ee('EE::API::Entities::MergeRequestBasic', with_descendants: true)
::API::Entities::Namespace.prepend_if_ee('EE::API::Entities::Namespace')
::API::Entities::Project.prepend_if_ee('EE::API::Entities::Project', with_descendants: true)
::API::Entities::ProtectedRefAccess.prepend_if_ee('EE::API::Entities::ProtectedRefAccess')
::API::Entities::UserPublic.prepend_if_ee('EE::API::Entities::UserPublic', with_descendants: true)
::API::Entities::Todo.prepend_if_ee('EE::API::Entities::Todo')
::API::Entities::ProtectedBranch.prepend_if_ee('EE::API::Entities::ProtectedBranch')
::API::Entities::Identity.prepend_if_ee('EE::API::Entities::Identity')
::API::Entities::UserWithAdmin.prepend_if_ee('EE::API::Entities::UserWithAdmin', with_descendants: true)
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