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
53644007
Commit
53644007
authored
Feb 24, 2016
by
cnam-dep
Committed by
Rémy Coutable
May 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Expose Issue#user_notes_count
parent
618033fb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
6 deletions
+33
-6
CHANGELOG
CHANGELOG
+3
-0
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+4
-0
doc/api/issues.md
doc/api/issues.md
+10
-5
lib/api/entities.rb
lib/api/entities.rb
+1
-1
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+15
-0
No files found.
CHANGELOG
View file @
53644007
...
...
@@ -51,6 +51,9 @@ v 8.7.2
- Label titles in filters are now escaped properly
v 8.7.1
- API: Expose Issue#user_notes_count (Anton Popov)
v 8.7.1 (unreleased)
- Throttle the update of `project.last_activity_at` to 1 minute. !3848
- Fix .gitlab-ci.yml parsing issue when hidde job is a template without script definition. !3849
- Fix license detection to detect all license files, not only known licenses. !3878
...
...
app/models/concerns/issuable.rb
View file @
53644007
...
...
@@ -160,6 +160,10 @@ module Issuable
notes
.
awards
.
where
(
note:
"thumbsup"
).
count
end
def
user_notes_count
notes
.
user
.
count
end
def
subscribed_without_subscriptions?
(
user
)
participants
(
user
).
include?
(
user
)
end
...
...
doc/api/issues.md
View file @
53644007
...
...
@@ -77,7 +77,8 @@ Example response:
"created_at"
:
"2016-01-04T15:31:51.081Z"
,
"iid"
:
6
,
"labels"
:
[],
"subscribed"
:
false
"subscribed"
:
false
,
"user_notes_count"
:
1
}
]
```
...
...
@@ -154,7 +155,8 @@ Example response:
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"created_at"
:
"2016-01-04T15:31:46.176Z"
,
"subscribed"
:
false
"subscribed"
:
false
,
"user_notes_count"
:
1
}
]
```
...
...
@@ -216,7 +218,8 @@ Example response:
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"created_at"
:
"2016-01-04T15:31:46.176Z"
,
"subscribed"
:
false
"subscribed"
:
false
,
"user_notes_count"
:
1
}
```
...
...
@@ -271,7 +274,8 @@ Example response:
"description"
:
null
,
"updated_at"
:
"2016-01-07T12:44:33.959Z"
,
"milestone"
:
null
,
"subscribed"
:
true
"subscribed"
:
true
,
"user_notes_count"
:
0
}
```
...
...
@@ -329,7 +333,8 @@ Example response:
"id"
:
85
,
"assignee"
:
null
,
"milestone"
:
null
,
"subscribed"
:
true
"subscribed"
:
true
,
"user_notes_count"
:
0
}
```
...
...
lib/api/entities.rb
View file @
53644007
...
...
@@ -170,10 +170,10 @@ module API
expose
:label_names
,
as: :labels
expose
:milestone
,
using:
Entities
::
Milestone
expose
:assignee
,
:author
,
using:
Entities
::
UserBasic
expose
:subscribed
do
|
issue
,
options
|
issue
.
subscribed?
(
options
[
:current_user
])
end
expose
:user_notes_count
end
class
MergeRequest
<
ProjectEntity
...
...
spec/requests/api/issues_spec.rb
View file @
53644007
...
...
@@ -39,6 +39,7 @@ describe API::API, api: true do
let!
(
:empty_milestone
)
do
create
(
:milestone
,
title:
'2.0.0'
,
project:
project
)
end
let!
(
:issue_note
)
{
create
(
:note
,
noteable:
issue
,
project:
project
,
author:
user
)
}
before
{
project
.
team
<<
[
user
,
:reporter
]
}
...
...
@@ -128,6 +129,13 @@ describe API::API, api: true do
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
it
'should return an count notes in issue'
do
get
api
(
"/issues"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'user_notes_count'
]).
to
eq
(
1
)
end
end
end
...
...
@@ -229,6 +237,13 @@ describe API::API, api: true do
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
closed_issue
.
id
)
end
it
'should return an count notes in issue'
do
get
api
(
"
#{
base_url
}
/issues"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'user_notes_count'
]).
to
eq
(
1
)
end
end
describe
"GET /projects/:id/issues/:issue_id"
do
...
...
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