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
iv
gitlab-ce
Commits
c1467f5d
Commit
c1467f5d
authored
Apr 05, 2016
by
Michael Greene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow back dating notes on creation
parent
28a7fe25
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
0 deletions
+20
-0
CHANGELOG
CHANGELOG
+1
-0
doc/api/notes.md
doc/api/notes.md
+1
-0
lib/api/notes.rb
lib/api/notes.rb
+5
-0
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+13
-0
No files found.
CHANGELOG
View file @
c1467f5d
...
...
@@ -23,6 +23,7 @@ v 8.7.0 (unreleased)
- Fix Error 500 after renaming a project path (Stan Hu)
- Fix a bug whith trailing slash in teamcity_url (Charles May)
- Allow back dating on issues when created or updated through the API
- Allow back dating on issue notes when created through the API
- Fix avatar stretching by providing a cropping feature
- API: Expose `subscribed` for issues and merge requests (Robert Schilling)
- Allow SAML to handle external users based on user's information !3530
...
...
doc/api/notes.md
View file @
c1467f5d
...
...
@@ -89,6 +89,7 @@ Parameters:
-
`id`
(required) - The ID of a project
-
`issue_id`
(required) - The ID of an issue
-
`body`
(required) - The content of a note
-
`created_at`
(optional) - Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z
### Modify existing issue note
...
...
lib/api/notes.rb
View file @
c1467f5d
...
...
@@ -61,6 +61,7 @@ module API
# id (required) - The ID of a project
# noteable_id (required) - The ID of an issue or snippet
# body (required) - The content of a note
# created_at (optional) - The date
# Example Request:
# POST /projects/:id/issues/:noteable_id/notes
# POST /projects/:id/snippets/:noteable_id/notes
...
...
@@ -73,6 +74,10 @@ module API
noteable_id:
params
[
noteable_id_str
]
}
if
params
[
:created_at
]
&&
(
current_user
.
is_admin?
||
user_project
.
owner
==
current_user
)
opts
[
:created_at
]
=
params
[
:created_at
]
end
@note
=
::
Notes
::
CreateService
.
new
(
user_project
,
current_user
,
opts
).
execute
if
@note
.
valid?
...
...
spec/requests/api/notes_spec.rb
View file @
c1467f5d
...
...
@@ -158,6 +158,19 @@ describe API::API, api: true do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
),
body:
'hi!'
expect
(
response
.
status
).
to
eq
(
401
)
end
context
'when an admin or owner makes the request'
do
it
'accepts the creation date to be set'
do
creation_time
=
2
.
weeks
.
ago
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
),
body:
'hi!'
,
created_at:
creation_time
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_within
(
1
.
second
).
of
(
creation_time
)
end
end
end
context
"when noteable is a Snippet"
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