Commit 4cc4eb64 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'reduce-diff-in-groups-create_service' into 'master'

[EE] Reduce diff with CE in Groups::CreateService

See merge request gitlab-org/gitlab-ee!9397
parents dd4a66b1 bd7e7e8f
......@@ -2,8 +2,6 @@
module Groups
class CreateService < Groups::BaseService
prepend ::EE::Groups::CreateService # rubocop: disable Cop/InjectEnterpriseEditionModule
def initialize(user, params = {})
@current_user, @params = user, params.dup
@chat_team = @params.delete(:create_chat_team)
......@@ -12,9 +10,7 @@ module Groups
def execute
@group = Group.new(params)
# Repository size limit comes as MB from the view
limit = params.delete(:repository_size_limit)
@group.repository_size_limit = Gitlab::Utils.try_megabytes_to_bytes(limit) if limit
after_build_hook(@group, params)
unless can_use_visibility_level? && can_create_group?
return @group
......@@ -36,6 +32,10 @@ module Groups
private
def after_build_hook(group, params)
# overriden in EE
end
def create_chat_team?
Gitlab.config.mattermost.enabled && @chat_team && group.chat_team.nil?
end
......@@ -69,3 +69,5 @@ module Groups
end
end
end
Groups::CreateService.prepend(EE::Groups::CreateService)
......@@ -12,6 +12,13 @@ module EE
private
override :after_build_hook
def after_build_hook(group, params)
# Repository size limit comes as MB from the view
limit = params.delete(:repository_size_limit)
group.repository_size_limit = ::Gitlab::Utils.try_megabytes_to_bytes(limit) if limit
end
def log_audit_event
::AuditEventService.new(
current_user,
......
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