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
37af75a2
Commit
37af75a2
authored
Jul 12, 2018
by
Kia Mei Somabes
Committed by
Rémy Coutable
Jul 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "do not set updated_at when creating note"
parent
d2c5ac61
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
0 deletions
+10
-0
changelogs/unreleased/46930-fix-updated_at-if-created_at-is-set-note-api.yml
...ed/46930-fix-updated_at-if-created_at-is-set-note-api.yml
+5
-0
doc/api/notes.md
doc/api/notes.md
+2
-0
lib/api/helpers/notes_helpers.rb
lib/api/helpers/notes_helpers.rb
+2
-0
spec/support/shared_examples/requests/api/notes.rb
spec/support/shared_examples/requests/api/notes.rb
+1
-0
No files found.
changelogs/unreleased/46930-fix-updated_at-if-created_at-is-set-note-api.yml
0 → 100644
View file @
37af75a2
---
title
:
Fix updated_at if created_at is set for Note API
merge_request
:
author
:
type
:
fixed
doc/api/notes.md
View file @
37af75a2
...
...
@@ -218,6 +218,7 @@ Parameters:
-
`id`
(required) - The ID or
[
URL-encoded path of the project
](
README.md#namespaced-path-encoding
)
-
`snippet_id`
(required) - The ID of a snippet
-
`body`
(required) - The content of a note
-
`created_at`
(optional) - Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z
```
bash
curl
--request
POST
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v4/projects/5/snippet/11/notes?body
=
note
...
...
@@ -340,6 +341,7 @@ Parameters:
-
`id`
(required) - The ID or
[
URL-encoded path of the project
](
README.md#namespaced-path-encoding
)
-
`merge_request_iid`
(required) - The IID of a merge request
-
`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 merge request note
...
...
lib/api/helpers/notes_helpers.rb
View file @
37af75a2
...
...
@@ -97,6 +97,8 @@ module API
current_user
.
admin?
||
parent
.
owned_by?
(
current_user
)
end
opts
[
:updated_at
]
=
opts
[
:created_at
]
if
opts
[
:created_at
]
project
=
parent
if
parent
.
is_a?
(
Project
)
::
Notes
::
CreateService
.
new
(
project
,
current_user
,
opts
).
execute
end
...
...
spec/support/shared_examples/requests/api/notes.rb
View file @
37af75a2
...
...
@@ -121,6 +121,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
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_like_time
(
creation_time
)
expect
(
Time
.
parse
(
json_response
[
'updated_at'
])).
to
be_like_time
(
creation_time
)
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