Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f7364440
Commit
f7364440
authored
Sep 05, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE::Projects::CreateService#after_create_actions
parent
43fac907
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
16 deletions
+23
-16
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+0
-16
ee/app/services/ee/projects/create_service.rb
ee/app/services/ee/projects/create_service.rb
+23
-0
No files found.
app/services/projects/create_service.rb
View file @
f7364440
...
...
@@ -107,11 +107,6 @@ module Projects
system_hook_service
.
execute_hooks_for
(
@project
,
:create
)
setup_authorizations
# EE-only
create_predefined_push_rule
@project
.
group
&
.
refresh_members_authorized_projects
end
# Refresh the current user's authorizations inline (so they can access the
...
...
@@ -179,16 +174,5 @@ module Projects
@project
.
path
=
@project
.
name
.
dup
.
parameterize
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
ee/app/services/ee/projects/create_service.rb
View file @
f7364440
...
...
@@ -16,6 +16,29 @@ module EE
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment