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
1144b70a
Commit
1144b70a
authored
Nov 20, 2015
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change update_forks_visibility_level into after_update hook in Project model
parent
945e4293
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
14 deletions
+13
-14
app/models/project.rb
app/models/project.rb
+13
-0
app/services/projects/update_service.rb
app/services/projects/update_service.rb
+0
-14
No files found.
app/models/project.rb
View file @
1144b70a
...
...
@@ -61,6 +61,19 @@ class Project < ActiveRecord::Base
update_column
(
:last_activity_at
,
self
.
created_at
)
end
# update visibility_levet of forks
after_update
:update_forks_visibility_level
def
update_forks_visibility_level
return
unless
visibility_level
<
visibility_level_was
forks
.
each
do
|
forked_project
|
if
forked_project
.
visibility_level
>
visibility_level
forked_project
.
visibility_level
=
visibility_level
forked_project
.
save!
end
end
end
ActsAsTaggableOn
.
strict_case_match
=
true
acts_as_taggable_on
:tags
...
...
app/services/projects/update_service.rb
View file @
1144b70a
...
...
@@ -13,7 +13,6 @@ module Projects
end
return
false
unless
visibility_level_allowed?
(
new_visibility
)
update_forks_visibility_level
(
new_visibility
.
to_i
)
end
new_branch
=
params
[
:default_branch
]
...
...
@@ -42,18 +41,5 @@ module Projects
false
end
def
update_forks_visibility_level
(
new_level
)
return
unless
new_level
<
project
.
visibility_level
project
.
forks
.
each
do
|
forked_project
|
fork_level
=
forked_project
.
visibility_level
if
fork_level
>
new_level
forked_project
.
visibility_level
=
new_level
forked_project
.
save!
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