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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
fa6b0a36
Commit
fa6b0a36
authored
Nov 30, 2017
by
Francisco Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes after rebase
parent
966f83f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
lib/api/entities.rb
lib/api/entities.rb
+14
-3
No files found.
lib/api/entities.rb
View file @
fa6b0a36
...
@@ -87,14 +87,25 @@ module API
...
@@ -87,14 +87,25 @@ module API
expose
:created_at
expose
:created_at
end
end
class
BasicProjectDetails
<
ProjectIdentity
class
BasicProjectDetails
<
Grape
::
Entity
expose
:default_branch
,
:tag_list
include
::
API
::
ProjectsRelationBuilder
expose
:default_branch
# Avoids an N+1 query: https://github.com/mbleigh/acts-as-taggable-on/issues/91#issuecomment-168273770
expose
:tag_list
do
|
project
|
# project.tags.order(:name).pluck(:name) is the most suitable option
# to avoid loading all the ActiveRecord objects but, if we use it here
# it override the preloaded associations and makes a query
# (fixed in https://github.com/rails/rails/pull/25976).
project
.
tags
.
map
(
&
:name
).
sort
end
expose
:ssh_url_to_repo
,
:http_url_to_repo
,
:web_url
expose
:ssh_url_to_repo
,
:http_url_to_repo
,
:web_url
expose
:avatar_url
do
|
project
,
options
|
expose
:avatar_url
do
|
project
,
options
|
project
.
avatar_url
(
only_path:
false
)
project
.
avatar_url
(
only_path:
false
)
end
end
expose
:star_count
,
:forks_count
expose
:star_count
,
:forks_count
expose
:
created_at
,
:
last_activity_at
expose
:last_activity_at
def
self
.
preload_relation
(
projects_relation
,
options
=
{})
def
self
.
preload_relation
(
projects_relation
,
options
=
{})
projects_relation
.
preload
(
:project_feature
,
:route
)
projects_relation
.
preload
(
:project_feature
,
:route
)
...
...
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