BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
6f41e3d9
Commit
6f41e3d9
authored
Nov 18, 2015
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change forks method to has_many relation
parent
e40c13ae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
project.rb
app/models/project.rb
+4
-5
update_service.rb
app/services/projects/update_service.rb
+1
-2
No files found.
app/models/project.rb
View file @
6f41e3d9
...
...
@@ -98,8 +98,11 @@ class Project < ActiveRecord::Base
has_one
:external_wiki_service
,
dependent: :destroy
has_one
:forked_project_link
,
dependent: :destroy
,
foreign_key:
"forked_to_project_id"
has_one
:forked_from_project
,
through: :forked_project_link
has_many
:forked_project_links
,
foreign_key:
"forked_from_project_id"
has_many
:forks
,
through: :forked_project_links
,
source: :forked_to_project
# Merge Requests for target project should be removed with it
has_many
:merge_requests
,
dependent: :destroy
,
foreign_key:
'target_project_id'
# Merge requests from source project should be kept when source project was removed
...
...
@@ -734,10 +737,6 @@ class Project < ActiveRecord::Base
forks
.
count
end
def
forks
ForkedProjectLink
.
where
(
forked_from_project_id:
self
.
id
)
end
def
find_label
(
name
)
labels
.
find_by
(
name:
name
)
end
...
...
app/services/projects/update_service.rb
View file @
6f41e3d9
...
...
@@ -44,8 +44,7 @@ module Projects
end
def
update_forks_visibility_level
(
new_level
)
project
.
forks
.
each
do
|
forked_link
|
forked_project
=
forked_link
.
forked_to_project
project
.
forks
.
each
do
|
forked_project
|
fork_level
=
forked_project
.
visibility_level
if
fork_level
>
new_level
.
to_i
...
...
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