Commit f7364440 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Extract EE::Projects::CreateService#after_create_actions

parent 43fac907
...@@ -107,11 +107,6 @@ module Projects ...@@ -107,11 +107,6 @@ module Projects
system_hook_service.execute_hooks_for(@project, :create) system_hook_service.execute_hooks_for(@project, :create)
setup_authorizations setup_authorizations
# EE-only
create_predefined_push_rule
@project.group&.refresh_members_authorized_projects
end end
# Refresh the current user's authorizations inline (so they can access the # Refresh the current user's authorizations inline (so they can access the
...@@ -179,16 +174,5 @@ module Projects ...@@ -179,16 +174,5 @@ module Projects
@project.path = @project.name.dup.parameterize @project.path = @project.name.dup.parameterize
end end
end end
def create_predefined_push_rule
return unless project.feature_available?(:push_rules)
predefined_push_rule = PushRule.find_by(is_sample: true)
if predefined_push_rule
push_rule = predefined_push_rule.dup.tap { |gh| gh.is_sample = false }
project.push_rule = push_rule
end
end
end end
end end
...@@ -16,6 +16,29 @@ module EE ...@@ -16,6 +16,29 @@ module EE
end end
end end
end end
private
def after_create_actions
raise NotImplementedError unless defined?(super)
super
create_predefined_push_rule
@project.group&.refresh_members_authorized_projects
end
def create_predefined_push_rule
return unless project.feature_available?(:push_rules)
predefined_push_rule = PushRule.find_by(is_sample: true)
if predefined_push_rule
push_rule = predefined_push_rule.dup.tap { |gh| gh.is_sample = false }
project.push_rule = push_rule
end
end
end end
end end
end end
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