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
afa53810
Commit
afa53810
authored
Mar 31, 2017
by
Douwe Maan
Committed by
Luke "Jared" Bennett
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
21e10888
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
576 additions
and
585 deletions
+576
-585
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+4
-3
app/finders/notes_finder.rb
app/finders/notes_finder.rb
+2
-2
app/views/notify/_note_email.html.haml
app/views/notify/_note_email.html.haml
+1
-1
app/views/notify/_note_email.text.erb
app/views/notify/_note_email.text.erb
+1
-1
lib/gitlab/diff/position.rb
lib/gitlab/diff/position.rb
+1
-1
spec/features/merge_requests/diff_notes_avatars_spec.rb
spec/features/merge_requests/diff_notes_avatars_spec.rb
+2
-4
spec/features/merge_requests/diff_notes_resolve_spec.rb
spec/features/merge_requests/diff_notes_resolve_spec.rb
+1
-1
spec/helpers/notes_helper_spec.rb
spec/helpers/notes_helper_spec.rb
+0
-17
spec/lib/gitlab/import_export/safe_model_attributes.yml
spec/lib/gitlab/import_export/safe_model_attributes.yml
+1
-0
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+1
-1
spec/models/concerns/noteable_spec.rb
spec/models/concerns/noteable_spec.rb
+7
-7
spec/models/concerns/resolvable_discussion_spec.rb
spec/models/concerns/resolvable_discussion_spec.rb
+547
-0
spec/models/discussion_spec.rb
spec/models/discussion_spec.rb
+0
-537
spec/models/note_spec.rb
spec/models/note_spec.rb
+6
-6
spec/services/issues/build_service_spec.rb
spec/services/issues/build_service_spec.rb
+2
-4
No files found.
app/assets/javascripts/notes.js
View file @
afa53810
...
...
@@ -769,6 +769,10 @@ require('./task_list');
form
.
find
(
'
.js-note-new-discussion
'
).
remove
();
this
.
setupNoteForm
(
form
);
form
.
removeClass
(
'
js-main-target-form
'
)
.
addClass
(
"
discussion-form js-discussion-note-form
"
);
if
(
typeof
gl
.
diffNotesCompileComponents
!==
'
undefined
'
)
{
var
$commentBtn
=
form
.
find
(
'
comment-and-resolve-btn
'
);
$commentBtn
.
attr
(
'
:discussion-id
'
,
"
'
"
+
discussionID
+
"
'
"
);
...
...
@@ -780,9 +784,6 @@ require('./task_list');
form
.
find
(
'
.js-comment-resolve-button
'
)
.
attr
(
'
data-discussion-id
'
,
discussionID
);
form
.
removeClass
(
'
js-main-target-form
'
)
.
addClass
(
"
discussion-form js-discussion-note-form
"
);
};
/*
...
...
app/finders/notes_finder.rb
View file @
afa53810
...
...
@@ -98,9 +98,9 @@ class NotesFinder
#
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
#
def
search
(
query
,
notes
)
def
search
(
notes
)
query
=
@params
[
:search
]
return
unless
query
return
notes
unless
query
pattern
=
"%
#{
query
}
%"
notes
.
where
(
Note
.
arel_table
[
:note
].
matches
(
pattern
))
...
...
app/views/notify/_note_email.html.haml
View file @
afa53810
-
discussion
=
@note
.
discussion
unless
@discussion
.
individual_note
?
-
discussion
=
@note
.
discussion
if
@note
.
part_of_discussion
?
-
if
discussion
%p
.details
=
succeed
':'
do
...
...
app/views/notify/_note_email.text.erb
View file @
afa53810
<%
discussion
=
@note
.
discussion
unless
@discussion
.
individual_note
?
-%>
<%
discussion
=
@note
.
discussion
if
@note
.
part_of_discussion
?
-%>
<%
if
discussion
&&
!
discussion
.
individual_note?
-%>
<%=
@note
.
author_name
-%>
<%
if
discussion
.
new_discussion?
-%>
...
...
lib/gitlab/diff/position.rb
View file @
afa53810
spec/features/merge_requests/diff_notes_avatars_spec.rb
View file @
afa53810
...
...
@@ -163,11 +163,9 @@ feature 'Diff note avatars', feature: true, js: true do
end
context
'multiple comments'
do
before
do
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
position
)
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
position
)
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
position
)
let!
(
:notes
)
{
create_list
(
:diff_note_on_merge_request
,
3
,
project:
project
,
noteable:
merge_request
,
in_reply_to:
note
)
}
before
do
visit
diffs_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
,
view:
view
)
wait_for_ajax
...
...
spec/features/merge_requests/diff_notes_resolve_spec.rb
View file @
afa53810
...
...
@@ -191,7 +191,7 @@ feature 'Diff notes resolve', feature: true, js: true do
context
'multiple notes'
do
before
do
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
in_reply_to:
note
)
visit_merge_request
end
...
...
spec/helpers/notes_helper_spec.rb
View file @
afa53810
...
...
@@ -36,21 +36,4 @@ describe NotesHelper do
expect
(
helper
.
note_max_access_for_user
(
other_note
)).
to
eq
(
'Reporter'
)
end
end
describe
'#preload_max_access_for_authors'
do
before
do
# This method reads cache from RequestStore, so make sure it's clean.
RequestStore
.
clear!
end
it
'loads multiple users'
do
expected_access
=
{
owner
.
id
=>
Gitlab
::
Access
::
OWNER
,
master
.
id
=>
Gitlab
::
Access
::
MASTER
,
reporter
.
id
=>
Gitlab
::
Access
::
REPORTER
}
expect
(
helper
.
preload_max_access_for_authors
(
notes
,
project
)).
to
eq
(
expected_access
)
end
end
end
spec/lib/gitlab/import_export/safe_model_attributes.yml
View file @
afa53810
...
...
@@ -55,6 +55,7 @@ Note:
-
resolved_at
-
resolved_by_id
-
discussion_id
-
original_discussion_id
LabelLink
:
-
id
-
label_id
...
...
spec/mailers/notify_spec.rb
View file @
afa53810
...
...
@@ -755,7 +755,7 @@ describe Notify do
end
shared_examples
'an email for a note on a diff discussion'
do
|
model
|
let
(
:note
)
{
create
(
model
,
project:
project
,
author:
note_author
)
}
let
(
:note
)
{
create
(
model
,
author:
note_author
)
}
it
"includes diffs with character-level highlighting"
do
is_expected
.
to
have_body_text
'<span class="p">}</span></span>'
...
...
spec/models/concerns/noteable_spec.rb
View file @
afa53810
...
...
@@ -4,14 +4,14 @@ describe MergeRequest, Noteable, model: true do
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:project
)
{
merge_request
.
project
}
let!
(
:active_diff_note1
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
let!
(
:active_diff_note2
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
let!
(
:active_diff_note2
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
in_reply_to:
active_diff_note1
)
}
let!
(
:active_diff_note3
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
active_position2
)
}
let!
(
:outdated_diff_note1
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
outdated_position
)
}
let!
(
:outdated_diff_note2
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
outdated_position
)
}
let!
(
:outdated_diff_note2
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
outdated_position
,
in_reply_to:
outdated_diff_note1
)
}
let!
(
:discussion_note1
)
{
create
(
:discussion_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
let!
(
:discussion_note2
)
{
create
(
:discussion_note_on_merge_request
,
in_reply_to:
discussion_note1
)
}
let!
(
:commit_diff_note1
)
{
create
(
:diff_note_on_commit
,
project:
project
)
}
let!
(
:commit_diff_note2
)
{
create
(
:diff_note_on_commit
,
project:
project
)
}
let!
(
:commit_diff_note2
)
{
create
(
:diff_note_on_commit
,
project:
project
,
in_reply_to:
commit_diff_note1
)
}
let!
(
:commit_note1
)
{
create
(
:note_on_commit
,
project:
project
)
}
let!
(
:commit_note2
)
{
create
(
:note_on_commit
,
project:
project
)
}
let!
(
:commit_discussion_note1
)
{
create
(
:discussion_note_on_commit
,
project:
project
)
}
...
...
@@ -63,7 +63,7 @@ describe MergeRequest, Noteable, model: true do
subject
{
merge_request
.
grouped_diff_discussions
}
it
"includes active discussions"
do
discussions
=
subject
.
values
discussions
=
subject
.
values
.
flatten
expect
(
discussions
.
count
).
to
eq
(
2
)
expect
(
discussions
.
map
(
&
:id
)).
to
eq
([
active_diff_note1
.
discussion_id
,
active_diff_note3
.
discussion_id
])
...
...
@@ -74,12 +74,12 @@ describe MergeRequest, Noteable, model: true do
end
it
"doesn't include outdated discussions"
do
expect
(
subject
.
values
.
map
(
&
:id
)).
not_to
include
(
outdated_diff_note1
.
discussion_id
)
expect
(
subject
.
values
.
flatten
.
map
(
&
:id
)).
not_to
include
(
outdated_diff_note1
.
discussion_id
)
end
it
"groups the discussions by line code"
do
expect
(
subject
[
active_diff_note1
.
line_code
].
id
).
to
eq
(
active_diff_note1
.
discussion_id
)
expect
(
subject
[
active_diff_note3
.
line_code
].
id
).
to
eq
(
active_diff_note3
.
discussion_id
)
expect
(
subject
[
active_diff_note1
.
line_code
].
first
.
id
).
to
eq
(
active_diff_note1
.
discussion_id
)
expect
(
subject
[
active_diff_note3
.
line_code
].
first
.
id
).
to
eq
(
active_diff_note3
.
discussion_id
)
end
end
end
spec/models/concerns/resolvable_discussion_spec.rb
0 → 100644
View file @
afa53810
This diff is collapsed.
Click to expand it.
spec/models/discussion_spec.rb
View file @
afa53810
This diff is collapsed.
Click to expand it.
spec/models/note_spec.rb
View file @
afa53810
...
...
@@ -263,10 +263,10 @@ describe Note, models: true do
let!
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:project
)
{
merge_request
.
project
}
let!
(
:active_diff_note1
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
let!
(
:active_diff_note2
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
let!
(
:active_diff_note2
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
in_reply_to:
active_diff_note1
)
}
let!
(
:active_diff_note3
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
active_position2
)
}
let!
(
:outdated_diff_note1
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
outdated_position
)
}
let!
(
:outdated_diff_note2
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
position:
outdated_position
)
}
let!
(
:outdated_diff_note2
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
in_reply_to:
outdated_diff_note1
)
}
let
(
:active_position2
)
do
Gitlab
::
Diff
::
Position
.
new
(
...
...
@@ -291,7 +291,7 @@ describe Note, models: true do
subject
{
merge_request
.
notes
.
grouped_diff_discussions
}
it
"includes active discussions"
do
discussions
=
subject
.
values
discussions
=
subject
.
values
.
flatten
expect
(
discussions
.
count
).
to
eq
(
2
)
expect
(
discussions
.
map
(
&
:id
)).
to
eq
([
active_diff_note1
.
discussion_id
,
active_diff_note3
.
discussion_id
])
...
...
@@ -302,12 +302,12 @@ describe Note, models: true do
end
it
"doesn't include outdated discussions"
do
expect
(
subject
.
values
.
map
(
&
:id
)).
not_to
include
(
outdated_diff_note1
.
discussion_id
)
expect
(
subject
.
values
.
flatten
.
map
(
&
:id
)).
not_to
include
(
outdated_diff_note1
.
discussion_id
)
end
it
"groups the discussions by line code"
do
expect
(
subject
[
active_diff_note1
.
line_code
].
id
).
to
eq
(
active_diff_note1
.
discussion_id
)
expect
(
subject
[
active_diff_note3
.
line_code
].
id
).
to
eq
(
active_diff_note3
.
discussion_id
)
expect
(
subject
[
active_diff_note1
.
line_code
].
first
.
id
).
to
eq
(
active_diff_note1
.
discussion_id
)
expect
(
subject
[
active_diff_note3
.
line_code
].
first
.
id
).
to
eq
(
active_diff_note3
.
discussion_id
)
end
end
...
...
spec/services/issues/build_service_spec.rb
View file @
afa53810
...
...
@@ -91,9 +91,7 @@ describe Issues::BuildService, services: true do
end
describe
'with multiple discussions'
do
before
do
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
merge_request
.
target_project
,
line_number:
15
)
end
let!
(
:diff_note
)
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
merge_request
.
target_project
,
line_number:
15
)
}
it
'mentions all the authors in the description'
do
authors
=
merge_request
.
resolvable_discussions
.
map
(
&
:author
)
...
...
@@ -109,7 +107,7 @@ describe Issues::BuildService, services: true do
end
it
'mentions additional notes'
do
create_list
(
:diff_note_on_merge_request
,
2
,
noteable:
merge_request
,
project:
merge_request
.
target_project
,
line_number:
15
)
create_list
(
:diff_note_on_merge_request
,
2
,
noteable:
merge_request
,
project:
merge_request
.
target_project
,
in_reply_to:
diff_note
)
expect
(
issue
.
description
).
to
include
(
'(+2 comments)'
)
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