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
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
app/services/projects/forks_count_service.rb
app/services/projects/forks_count_service.rb
+4
-1
lib/api/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
end
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
lib/api/entities.rb
View file @
3527d1ff
...
...
@@ -163,9 +163,7 @@ module API
expose
:lfs_enabled?
,
as: :lfs_enabled
expose
:creator_id
expose
:namespace
,
using:
'API::Entities::NamespaceBasic'
expose
:forked_from_project
,
using:
Entities
::
BasicProjectDetails
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
do
|
project
,
options
|
project
.
fork_network_member
.
forked_from_project
end
expose
:forked_from_project
,
using:
Entities
::
BasicProjectDetails
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:import_status
expose
:import_error
,
if:
lambda
{
|
_project
,
options
|
options
[
:user_can_admin_project
]
}
...
...
@@ -184,17 +182,15 @@ module API
expose
:statistics
,
using:
'API::Entities::ProjectStatistics'
,
if: :statistics
def
self
.
preload_relation
(
projects_relation
,
options
=
{})
relation
=
super
(
projects_relation
).
preload
(
:group
)
super
(
projects_relation
).
preload
(
:group
)
.
preload
(
project_group_links: :group
,
fork_network: :root_project
,
fork_network_member:
[
forked_from_project:
[
:route
,
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
)
forked_project_link: :forked_from_project
,
forked_from_project:
[
:route
,
:forks
,
namespace: :route
,
tags: :taggings
])
end
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
...
...
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