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
4dbd6de1
Commit
4dbd6de1
authored
Feb 25, 2019
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure notes insertion order same as draft note
Notes should be in the same order as user comment order.
parent
df4c9b24
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
2 deletions
+13
-2
ee/app/models/draft_note.rb
ee/app/models/draft_note.rb
+1
-0
ee/app/services/draft_notes/base_service.rb
ee/app/services/draft_notes/base_service.rb
+1
-1
ee/changelogs/unreleased/9137-notes-order.yml
ee/changelogs/unreleased/9137-notes-order.yml
+5
-0
ee/spec/services/draft_notes/publish_service_spec.rb
ee/spec/services/draft_notes/publish_service_spec.rb
+6
-1
No files found.
ee/app/models/draft_note.rb
View file @
4dbd6de1
...
...
@@ -2,6 +2,7 @@
class
DraftNote
<
ActiveRecord
::
Base
include
DiffPositionableNote
include
Gitlab
::
Utils
::
StrongMemoize
include
Sortable
PUBLISH_ATTRS
=
%i(noteable_id noteable_type type note)
.
freeze
DIFF_ATTRS
=
%i(position original_position change_position)
.
freeze
...
...
ee/app/services/draft_notes/base_service.rb
View file @
4dbd6de1
...
...
@@ -11,7 +11,7 @@ module DraftNotes
private
def
draft_notes
@draft_notes
||=
merge_request
.
draft_notes
.
authored_by
(
current_user
)
@draft_notes
||=
merge_request
.
draft_notes
.
order_id_asc
.
authored_by
(
current_user
)
end
def
project
...
...
ee/changelogs/unreleased/9137-notes-order.yml
0 → 100644
View file @
4dbd6de1
---
title
:
Ensure comments from merge request review is displayed in the same order as user commenting order
merge_request
:
9684
author
:
type
:
fixed
ee/spec/services/draft_notes/publish_service_spec.rb
View file @
4dbd6de1
...
...
@@ -32,7 +32,8 @@ describe DraftNotes::PublishService do
context
'multiple draft notes'
do
before
do
create_list
(
:draft_note
,
2
,
merge_request:
merge_request
,
author:
user
)
create
(
:draft_note
,
merge_request:
merge_request
,
author:
user
,
note:
'first note'
)
create
(
:draft_note
,
merge_request:
merge_request
,
author:
user
,
note:
'second note'
)
end
context
'when review fails to create'
do
...
...
@@ -63,6 +64,10 @@ describe DraftNotes::PublishService do
it
'publishes all draft notes for a user in a merge request'
do
expect
{
publish
}.
to
change
{
DraftNote
.
count
}.
by
(
-
2
).
and
change
{
Note
.
count
}.
by
(
2
).
and
change
{
Review
.
count
}.
by
(
1
)
expect
(
DraftNote
.
count
).
to
eq
(
0
)
notes
=
merge_request
.
notes
.
order
(
id: :asc
)
expect
(
notes
.
first
.
note
).
to
eq
(
'first note'
)
expect
(
notes
.
last
.
note
).
to
eq
(
'second note'
)
end
it
'sends batch notification'
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