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
e0b6838a
Commit
e0b6838a
authored
5 years ago
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set correct timestamps when creating past issues
Sets `system_note_timestamp` from `created_at`
parent
7994db79
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
2 deletions
+16
-2
app/models/concerns/noteable.rb
app/models/concerns/noteable.rb
+1
-1
changelogs/unreleased/58361-issue-create-system-note-timestamp.yml
...s/unreleased/58361-issue-create-system-note-timestamp.yml
+5
-0
lib/api/issues.rb
lib/api/issues.rb
+1
-0
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+9
-1
No files found.
app/models/concerns/noteable.rb
View file @
e0b6838a
...
@@ -13,7 +13,7 @@ module Noteable
...
@@ -13,7 +13,7 @@ module Noteable
end
end
end
end
# The timestamp of the note (e.g. the :updated_at attribute if provided via
# The timestamp of the note (e.g. the :
created_at or :
updated_at attribute if provided via
# API call)
# API call)
def
system_note_timestamp
def
system_note_timestamp
@system_note_timestamp
||
Time
.
now
# rubocop:disable Gitlab/ModuleWithInstanceVariables
@system_note_timestamp
||
Time
.
now
# rubocop:disable Gitlab/ModuleWithInstanceVariables
...
...
This diff is collapsed.
Click to expand it.
changelogs/unreleased/58361-issue-create-system-note-timestamp.yml
0 → 100644
View file @
e0b6838a
---
title
:
Fix system notes timestamp when creating issue in the past
merge_request
:
27406
author
:
type
:
fixed
This diff is collapsed.
Click to expand it.
lib/api/issues.rb
View file @
e0b6838a
...
@@ -192,6 +192,7 @@ module API
...
@@ -192,6 +192,7 @@ module API
params
.
delete
(
:iid
)
unless
current_user
.
can?
(
:set_issue_iid
,
user_project
)
params
.
delete
(
:iid
)
unless
current_user
.
can?
(
:set_issue_iid
,
user_project
)
issue_params
=
declared_params
(
include_missing:
false
)
issue_params
=
declared_params
(
include_missing:
false
)
issue_params
[
:system_note_timestamp
]
=
params
[
:created_at
]
issue_params
=
convert_parameters_from_legacy_format
(
issue_params
)
issue_params
=
convert_parameters_from_legacy_format
(
issue_params
)
...
...
This diff is collapsed.
Click to expand it.
spec/requests/api/issues_spec.rb
View file @
e0b6838a
...
@@ -1480,12 +1480,20 @@ describe API::Issues do
...
@@ -1480,12 +1480,20 @@ describe API::Issues do
let
(
:params
)
{
{
title:
'new issue'
,
labels:
'label, label2'
,
created_at:
creation_time
}
}
let
(
:params
)
{
{
title:
'new issue'
,
labels:
'label, label2'
,
created_at:
creation_time
}
}
context
'by an admin'
do
context
'by an admin'
do
it
'sets the creation time on the new issue'
do
before
do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
admin
),
params:
params
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
admin
),
params:
params
end
it
'sets the creation time on the new issue'
do
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
creation_time
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
creation_time
)
end
end
it
'sets the system notes timestamp based on creation time'
do
issue
=
Issue
.
find
(
json_response
[
'id'
])
expect
(
issue
.
resource_label_events
.
last
.
created_at
).
to
be_like_time
(
creation_time
)
end
end
end
context
'by a project owner'
do
context
'by a project owner'
do
...
...
This diff is collapsed.
Click to expand it.
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