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
cf12763d
Commit
cf12763d
authored
Nov 30, 2012
by
Valeriy Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2127 from NARKOZ/notes-api
API: don't expose 'updated_at' for notes
parents
eb061b9b
ee6187bd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
6 deletions
+47
-6
CHANGELOG
CHANGELOG
+3
-3
doc/api/notes.md
doc/api/notes.md
+17
-2
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/notes.rb
lib/api/notes.rb
+18
-0
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+8
-0
No files found.
CHANGELOG
View file @
cf12763d
v 3.2.0
v 3.2.0
- [API]
create notes for snippets and issu
es
- [API]
list, create issue not
es
- [API] list
notes for snippets and issu
es
- [API] list
, create snippet not
es
- [API] list
project
wall notes
- [API] list
, create
wall notes
- Remove project code - use path instead
- Remove project code - use path instead
- added username field to user
- added username field to user
- rake task to fill usernames based on emails create namespaces for users
- rake task to fill usernames based on emails create namespaces for users
...
...
doc/api/notes.md
View file @
cf12763d
...
@@ -20,8 +20,7 @@ GET /projects/:id/notes
...
@@ -20,8 +20,7 @@ GET /projects/:id/notes
"blocked"
:
false
,
"blocked"
:
false
,
"created_at"
:
"2012-05-23T08:00:58Z"
"created_at"
:
"2012-05-23T08:00:58Z"
},
},
"updated_at"
:
"2012-11-27T19:16:44Z"
,
"created_at"
:
"2012-11-27T19:16:44Z"
"created_at"
:
"2012-11-27T19:16:44Z"
}
}
]
]
```
```
...
@@ -88,6 +87,22 @@ Parameters:
...
@@ -88,6 +87,22 @@ Parameters:
## New note
## New note
### New wall note
Create a new wall note.
```
POST /projects/:id/notes
```
Parameters:
+
`id`
(required) - The ID or code name of a project
+
`body`
(required) - The content of a note
Will return created note with status
`201 Created`
on success, or
`404 Not found`
on fail.
### New issue note
### New issue note
Create a new issue note.
Create a new issue note.
...
...
lib/api/entities.rb
View file @
cf12763d
...
@@ -73,7 +73,7 @@ module Gitlab
...
@@ -73,7 +73,7 @@ module Gitlab
expose
:id
expose
:id
expose
:note
,
as: :body
expose
:note
,
as: :body
expose
:author
,
using:
Entities
::
UserBasic
expose
:author
,
using:
Entities
::
UserBasic
expose
:
updated_at
,
:
created_at
expose
:created_at
end
end
class
MRNote
<
Grape
::
Entity
class
MRNote
<
Grape
::
Entity
...
...
lib/api/notes.rb
View file @
cf12763d
...
@@ -17,6 +17,24 @@ module Gitlab
...
@@ -17,6 +17,24 @@ module Gitlab
present
paginate
(
@notes
),
with:
Entities
::
Note
present
paginate
(
@notes
),
with:
Entities
::
Note
end
end
# Create a new project wall note
#
# Parameters:
# id (required) - The ID or code name of a project
# body (required) - The content of a note
# Example Request:
# POST /projects/:id/notes
post
":id/notes"
do
@note
=
user_project
.
notes
.
new
(
note:
params
[
:body
])
@note
.
author
=
current_user
if
@note
.
save
present
@note
,
with:
Entities
::
Note
else
not_found!
end
end
NOTEABLE_TYPES
.
each
do
|
noteable_type
|
NOTEABLE_TYPES
.
each
do
|
noteable_type
|
noteables_str
=
noteable_type
.
to_s
.
underscore
.
pluralize
noteables_str
=
noteable_type
.
to_s
.
underscore
.
pluralize
noteable_id_str
=
"
#{
noteable_type
.
to_s
.
underscore
}
_id"
noteable_id_str
=
"
#{
noteable_type
.
to_s
.
underscore
}
_id"
...
...
spec/requests/api/notes_spec.rb
View file @
cf12763d
...
@@ -30,6 +30,14 @@ describe Gitlab::API do
...
@@ -30,6 +30,14 @@ describe Gitlab::API do
end
end
end
end
describe
"POST /projects/:id/notes"
do
it
"should create a new wall note"
do
post
api
(
"/projects/
#{
project
.
id
}
/notes"
,
user
),
body:
'hi!'
response
.
status
.
should
==
201
json_response
[
'body'
].
should
==
'hi!'
end
end
describe
"GET /projects/:id/noteable/:noteable_id/notes"
do
describe
"GET /projects/:id/noteable/:noteable_id/notes"
do
context
"when noteable is an Issue"
do
context
"when noteable is an Issue"
do
it
"should return an array of issue notes"
do
it
"should return an array of issue notes"
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