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
6e698b25
Commit
6e698b25
authored
May 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
14a0841a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
5 deletions
+14
-5
app/models/note.rb
app/models/note.rb
+5
-2
lib/gitlab/diff/position_tracer.rb
lib/gitlab/diff/position_tracer.rb
+0
-1
spec/features/merge_requests/discussion_spec.rb
spec/features/merge_requests/discussion_spec.rb
+1
-1
spec/helpers/notes_helper_spec.rb
spec/helpers/notes_helper_spec.rb
+7
-1
spec/lib/gitlab/import_export/safe_model_attributes.yml
spec/lib/gitlab/import_export/safe_model_attributes.yml
+1
-0
No files found.
app/models/note.rb
View file @
6e698b25
...
@@ -121,7 +121,7 @@ class Note < ActiveRecord::Base
...
@@ -121,7 +121,7 @@ class Note < ActiveRecord::Base
end
end
def
grouped_diff_discussions
(
diff_refs
=
nil
)
def
grouped_diff_discussions
(
diff_refs
=
nil
)
groups
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
}
groups
=
{
}
diff_notes
.
fresh
.
discussions
.
each
do
|
discussion
|
diff_notes
.
fresh
.
discussions
.
each
do
|
discussion
|
line_code
=
line_code
=
...
@@ -131,7 +131,10 @@ class Note < ActiveRecord::Base
...
@@ -131,7 +131,10 @@ class Note < ActiveRecord::Base
discussion
.
original_line_code
discussion
.
original_line_code
end
end
groups
[
line_code
]
<<
discussion
if
line_code
if
line_code
discussions
=
groups
[
line_code
]
||=
[]
discussions
<<
discussion
end
end
end
groups
groups
...
...
lib/gitlab/diff/position_tracer.rb
View file @
6e698b25
...
@@ -168,7 +168,6 @@ module Gitlab
...
@@ -168,7 +168,6 @@ module Gitlab
bd_diff
=
bd_diffs
.
diff_file_with_old_path
(
b_path
)
bd_diff
=
bd_diffs
.
diff_file_with_old_path
(
b_path
)
d_path
=
bd_diff
&
.
new_path
||
b_path
d_line
=
LineMapper
.
new
(
bd_diff
).
old_to_new
(
b_line
)
d_line
=
LineMapper
.
new
(
bd_diff
).
old_to_new
(
b_line
)
cd_diff
=
cd_diffs
.
diff_file_with_old_path
(
c_path
)
cd_diff
=
cd_diffs
.
diff_file_with_old_path
(
c_path
)
...
...
spec/features/merge_requests/discussion_spec.rb
View file @
6e698b25
...
@@ -43,7 +43,7 @@ feature 'Merge Request Discussions', feature: true do
...
@@ -43,7 +43,7 @@ feature 'Merge Request Discussions', feature: true do
it
'shows a link to the outdated diff'
do
it
'shows a link to the outdated diff'
do
within
(
".discussion[data-discussion-id='
#{
outdated_discussion
.
id
}
']"
)
do
within
(
".discussion[data-discussion-id='
#{
outdated_discussion
.
id
}
']"
)
do
path
=
diffs_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
,
diff_id:
old_merge_request_diff
.
id
,
anchor:
outdated_discussion
.
line_code
)
path
=
diffs_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
,
diff_id:
old_merge_request_diff
.
id
,
anchor:
outdated_discussion
.
line_code
)
expect
(
page
).
to
have_link
(
'an o
utdated
diff'
,
href:
path
)
expect
(
page
).
to
have_link
(
'an o
ld version of the
diff'
,
href:
path
)
end
end
end
end
end
end
...
...
spec/helpers/notes_helper_spec.rb
View file @
6e698b25
...
@@ -92,7 +92,13 @@ describe NotesHelper do
...
@@ -92,7 +92,13 @@ describe NotesHelper do
)
)
end
end
let
(
:discussion
)
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
,
position:
position
).
to_discussion
}
let
(
:diff_note
)
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
,
position:
position
)
}
let
(
:discussion
)
{
diff_note
.
to_discussion
}
before
do
diff_note
.
position
=
diff_note
.
original_position
diff_note
.
save!
end
it
'returns the diff version comparison path with the line code'
do
it
'returns the diff version comparison path with the line code'
do
expect
(
helper
.
discussion_path
(
discussion
)).
to
eq
(
diffs_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
,
diff_id:
merge_request_diff3
,
start_sha:
merge_request_diff1
.
head_commit_sha
,
anchor:
discussion
.
line_code
))
expect
(
helper
.
discussion_path
(
discussion
)).
to
eq
(
diffs_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
,
diff_id:
merge_request_diff3
,
start_sha:
merge_request_diff1
.
head_commit_sha
,
anchor:
discussion
.
line_code
))
...
...
spec/lib/gitlab/import_export/safe_model_attributes.yml
View file @
6e698b25
...
@@ -54,6 +54,7 @@ Note:
...
@@ -54,6 +54,7 @@ Note:
-
type
-
type
-
position
-
position
-
original_position
-
original_position
-
change_position
-
resolved_at
-
resolved_at
-
resolved_by_id
-
resolved_by_id
-
discussion_id
-
discussion_id
...
...
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