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
Boxiang Sun
gitlab-ce
Commits
3efae53b
Commit
3efae53b
authored
Dec 11, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add open_issues_count to project API
This is needed to support Huboard and a generally useful value.
parent
74dcbec3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
1 deletion
+30
-1
CHANGELOG
CHANGELOG
+1
-0
app/models/project.rb
app/models/project.rb
+4
-0
doc/api/projects.md
doc/api/projects.md
+3
-0
lib/api/entities.rb
lib/api/entities.rb
+1
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+5
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+16
-0
No files found.
CHANGELOG
View file @
3efae53b
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 8.3.0 (unreleased)
v 8.3.0 (unreleased)
- Add open_issues_count to project API (Stan Hu)
- Expand character set of usernames created by Omniauth (Corey Hinshaw)
- Expand character set of usernames created by Omniauth (Corey Hinshaw)
- Add button to automatically merge a merge request when the build succeeds (Zeger-Jan van de Weg)
- Add button to automatically merge a merge request when the build succeeds (Zeger-Jan van de Weg)
- Merge when build succeeds (Zeger-Jan van de Weg)
- Merge when build succeeds (Zeger-Jan van de Weg)
...
...
app/models/project.rb
View file @
3efae53b
...
@@ -825,4 +825,8 @@ class Project < ActiveRecord::Base
...
@@ -825,4 +825,8 @@ class Project < ActiveRecord::Base
forked_project_link
.
destroy
forked_project_link
.
destroy
end
end
end
end
def
open_issues_count
issues
.
opened
.
count
end
end
end
doc/api/projects.md
View file @
3efae53b
...
@@ -59,6 +59,7 @@ Parameters:
...
@@ -59,6 +59,7 @@ Parameters:
"path"
:
"diaspora-client"
,
"path"
:
"diaspora-client"
,
"path_with_namespace"
:
"diaspora/diaspora-client"
,
"path_with_namespace"
:
"diaspora/diaspora-client"
,
"issues_enabled"
:
true
,
"issues_enabled"
:
true
,
"open_issues_count"
:
1
,
"merge_requests_enabled"
:
true
,
"merge_requests_enabled"
:
true
,
"builds_enabled"
:
true
,
"builds_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
...
@@ -101,6 +102,7 @@ Parameters:
...
@@ -101,6 +102,7 @@ Parameters:
"path"
:
"puppet"
,
"path"
:
"puppet"
,
"path_with_namespace"
:
"brightbox/puppet"
,
"path_with_namespace"
:
"brightbox/puppet"
,
"issues_enabled"
:
true
,
"issues_enabled"
:
true
,
"open_issues_count"
:
1
,
"merge_requests_enabled"
:
true
,
"merge_requests_enabled"
:
true
,
"builds_enabled"
:
true
,
"builds_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
...
@@ -192,6 +194,7 @@ Parameters:
...
@@ -192,6 +194,7 @@ Parameters:
"path"
:
"diaspora-project-site"
,
"path"
:
"diaspora-project-site"
,
"path_with_namespace"
:
"diaspora/diaspora-project-site"
,
"path_with_namespace"
:
"diaspora/diaspora-project-site"
,
"issues_enabled"
:
true
,
"issues_enabled"
:
true
,
"open_issues_count"
:
1
,
"merge_requests_enabled"
:
true
,
"merge_requests_enabled"
:
true
,
"builds_enabled"
:
true
,
"builds_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
...
...
lib/api/entities.rb
View file @
3efae53b
...
@@ -68,6 +68,7 @@ module API
...
@@ -68,6 +68,7 @@ module API
expose
:forked_from_project
,
using:
Entities
::
ForkedFromProject
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:forked_from_project
,
using:
Entities
::
ForkedFromProject
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:avatar_url
expose
:avatar_url
expose
:star_count
,
:forks_count
expose
:star_count
,
:forks_count
expose
:open_issues_count
,
if:
lambda
{
|
project
,
options
|
project
.
issues_enabled?
&&
project
.
default_issues_tracker?
}
end
end
class
ProjectMember
<
UserBasic
class
ProjectMember
<
UserBasic
...
...
spec/models/project_spec.rb
View file @
3efae53b
...
@@ -153,13 +153,17 @@ describe Project, models: true do
...
@@ -153,13 +153,17 @@ describe Project, models: true do
describe
'#get_issue'
do
describe
'#get_issue'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
!
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
context
'with default issues tracker'
do
context
'with default issues tracker'
do
it
'returns an issue'
do
it
'returns an issue'
do
expect
(
project
.
get_issue
(
issue
.
iid
)).
to
eq
issue
expect
(
project
.
get_issue
(
issue
.
iid
)).
to
eq
issue
end
end
it
'returns count of open issues'
do
expect
(
project
.
open_issues_count
).
to
eq
(
1
)
end
it
'returns nil when no issue found'
do
it
'returns nil when no issue found'
do
expect
(
project
.
get_issue
(
999
)).
to
be_nil
expect
(
project
.
get_issue
(
999
)).
to
be_nil
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
3efae53b
...
@@ -65,6 +65,22 @@ describe API::API, api: true do
...
@@ -65,6 +65,22 @@ describe API::API, api: true do
expect
(
json_response
.
first
.
keys
).
to
include
(
'tag_list'
)
expect
(
json_response
.
first
.
keys
).
to
include
(
'tag_list'
)
end
end
it
'should include open_issues_count'
do
get
api
(
'/projects'
,
user
)
expect
(
response
.
status
).
to
eq
200
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
.
keys
).
to
include
(
'open_issues_count'
)
end
it
'should not include open_issues_count'
do
project
.
update_attributes
(
{
issues_enabled:
false
}
)
get
api
(
'/projects'
,
user
)
expect
(
response
.
status
).
to
eq
200
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
.
keys
).
not_to
include
(
'open_issues_count'
)
end
context
'and using search'
do
context
'and using search'
do
it
'should return searched project'
do
it
'should return searched project'
do
get
api
(
'/projects'
,
user
),
{
search:
project
.
name
}
get
api
(
'/projects'
,
user
),
{
search:
project
.
name
}
...
...
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