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
Tatuya Kamada
gitlab-ce
Commits
0cc95ef2
Commit
0cc95ef2
authored
Feb 26, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2889 from kennytm/master
Show only ≤16 lines of codes in a discussion in a MR (issue #2860).
parents
57394226
e565be24
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+25
-0
app/views/notes/_discussion_diff.html.haml
app/views/notes/_discussion_diff.html.haml
+1
-2
No files found.
app/helpers/commits_helper.rb
View file @
0cc95ef2
...
...
@@ -57,6 +57,31 @@ module CommitsHelper
end
end
def
each_diff_line_near
(
diff
,
index
,
expected_line_code
)
max_number_of_lines
=
16
prev_match_line
=
nil
prev_lines
=
[]
each_diff_line
(
diff
,
index
)
do
|
full_line
,
type
,
line_code
,
line_new
,
line_old
|
line
=
[
full_line
,
type
,
line_code
,
line_new
,
line_old
]
if
line_code
!=
expected_line_code
if
type
==
"match"
prev_lines
.
clear
prev_match_line
=
line
else
prev_lines
.
push
(
line
)
prev_lines
.
shift
if
prev_lines
.
length
>=
max_number_of_lines
end
else
yield
(
prev_match_line
)
if
!
prev_match_line
.
nil?
prev_lines
.
each
{
|
ln
|
yield
(
ln
)
}
yield
(
line
)
break
end
end
end
def
image_diff_class
(
diff
)
if
diff
.
deleted_file
"deleted"
...
...
app/views/notes/_discussion_diff.html.haml
View file @
0cc95ef2
...
...
@@ -9,7 +9,7 @@
%br
/
.content
%table
-
each_diff_line
(
diff
,
note
.
diff_file_index
)
do
|
line
,
type
,
line_code
,
line_new
,
line_old
|
-
each_diff_line
_near
(
diff
,
note
.
diff_file_index
,
note
.
line_code
)
do
|
line
,
type
,
line_code
,
line_new
,
line_old
|
%tr
.line_holder
{
id:
line_code
}
-
if
type
==
"match"
%td
.old_line
=
"..."
...
...
@@ -22,4 +22,3 @@
-
if
line_code
==
note
.
line_code
=
render
"notes/diff_notes_with_reply"
,
notes:
discussion_notes
-
break
# cut off diff after notes
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