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
2fc55b2e
Commit
2fc55b2e
authored
Aug 31, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fetch only current user projects
parent
76f5865d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
11 deletions
+6
-11
lib/api/entities.rb
lib/api/entities.rb
+3
-6
lib/api/v3/github_repos.rb
lib/api/v3/github_repos.rb
+2
-4
spec/requests/api/v3/github_repos_spec.rb
spec/requests/api/v3/github_repos_spec.rb
+1
-1
No files found.
lib/api/entities.rb
View file @
2fc55b2e
...
...
@@ -1092,16 +1092,13 @@ module API
end
module
Github
class
User
<
Grape
::
Entity
expose
:id
expose
:login
do
|
project
|
project
.
namespace
.
name
end
class
Namespace
<
Grape
::
Entity
expose
:path
,
as: :login
end
class
Repository
<
Grape
::
Entity
expose
:id
expose
:
owner
,
using:
User
,
unless:
->
(
project
,
options
)
{
project
.
group
}
expose
:
namespace
,
as: :owner
,
using:
Namespace
expose
:name
end
...
...
lib/api/v3/github_repos.rb
View file @
2fc55b2e
...
...
@@ -16,10 +16,8 @@ module API
end
resource
:users
do
get
':username/repos'
do
projects
=
ProjectsFinder
.
new
(
current_user:
current_user
,
params:
project_finder_params
).
execute
present
paginate
(
projects
),
with:
::
API
::
Entities
::
Github
::
Repository
get
':namespace/repos'
do
present
paginate
(
current_user
.
authorized_projects
),
with:
::
API
::
Entities
::
Github
::
Repository
end
end
...
...
spec/requests/api/v3/github_repos_spec.rb
View file @
2fc55b2e
...
...
@@ -26,7 +26,7 @@ describe API::V3::GithubRepos do
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
first
.
keys
).
to
contain_exactly
(
'id'
,
'owner'
,
'name'
)
expect
(
json_response
.
first
[
'owner'
].
keys
).
to
contain_exactly
(
'login'
,
'id'
)
expect
(
json_response
.
first
[
'owner'
].
keys
).
to
contain_exactly
(
'login'
)
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