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