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
3527d1ff
Commit
3527d1ff
authored
Nov 30, 2017
by
Francisco Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undoing the change to ForkNetworkMember
parent
fe95de88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
forks_count_service.rb
app/services/projects/forks_count_service.rb
+4
-1
entities.rb
lib/api/entities.rb
+7
-11
No files found.
app/services/projects/forks_count_service.rb
View file @
3527d1ff
...
@@ -10,7 +10,10 @@ module Projects
...
@@ -10,7 +10,10 @@ module Projects
end
end
def
self
.
query
(
project_ids
)
def
self
.
query
(
project_ids
)
ForkNetworkMember
.
where
(
forked_from_project:
project_ids
)
# We can't directly change ForkedProjectLink to ForkNetworkMember here
# Nowadays, when a call using v3 to projects/:id/fork is made,
# the relationship to ForkNetworkMember is not updated
ForkedProjectLink
.
where
(
forked_from_project:
project_ids
)
end
end
end
end
end
end
lib/api/entities.rb
View file @
3527d1ff
...
@@ -163,9 +163,7 @@ module API
...
@@ -163,9 +163,7 @@ module API
expose
:lfs_enabled?
,
as: :lfs_enabled
expose
:lfs_enabled?
,
as: :lfs_enabled
expose
:creator_id
expose
:creator_id
expose
:namespace
,
using:
'API::Entities::NamespaceBasic'
expose
:namespace
,
using:
'API::Entities::NamespaceBasic'
expose
:forked_from_project
,
using:
Entities
::
BasicProjectDetails
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
do
|
project
,
options
|
expose
:forked_from_project
,
using:
Entities
::
BasicProjectDetails
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
project
.
fork_network_member
.
forked_from_project
end
expose
:import_status
expose
:import_status
expose
:import_error
,
if:
lambda
{
|
_project
,
options
|
options
[
:user_can_admin_project
]
}
expose
:import_error
,
if:
lambda
{
|
_project
,
options
|
options
[
:user_can_admin_project
]
}
...
@@ -184,17 +182,15 @@ module API
...
@@ -184,17 +182,15 @@ module API
expose
:statistics
,
using:
'API::Entities::ProjectStatistics'
,
if: :statistics
expose
:statistics
,
using:
'API::Entities::ProjectStatistics'
,
if: :statistics
def
self
.
preload_relation
(
projects_relation
,
options
=
{})
def
self
.
preload_relation
(
projects_relation
,
options
=
{})
relation
=
super
(
projects_relation
).
preload
(
:group
)
super
(
projects_relation
).
preload
(
:group
)
.
preload
(
project_group_links: :group
,
.
preload
(
project_group_links: :group
,
fork_network: :root_project
,
fork_network: :root_project
,
fork_network_member:
[
forked_from_project:
[
:route
,
namespace: :route
,
tags: :taggings
]])
forked_project_link: :forked_from_project
,
forked_from_project:
[
:route
,
:forks
,
namespace: :route
,
tags: :taggings
])
# Remove this preload once forked_project_links and forked_from_project models have been removed
relation
.
preload
(
forked_project_link: :forked_from_project
)
end
end
def
self
.
forks_counting_projects
(
projects_relation
)
def
self
.
forks_counting_projects
(
projects_relation
)
projects_relation
+
projects_relation
.
map
(
&
:fork
_network_member
).
compact
.
map
(
&
:fork
ed_from_project
).
compact
projects_relation
+
projects_relation
.
map
(
&
:forked_from_project
).
compact
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