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
80a4c808
Commit
80a4c808
authored
Jan 12, 2016
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make diff_line_content helper return a safe String. #3945
parent
ee2230c3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+2
-2
app/views/projects/blob/preview.html.haml
app/views/projects/blob/preview.html.haml
+1
-1
app/views/projects/diffs/_text_file.html.haml
app/views/projects/diffs/_text_file.html.haml
+1
-1
app/views/projects/notes/discussions/_diff.html.haml
app/views/projects/notes/discussions/_diff.html.haml
+1
-1
No files found.
app/helpers/diff_helper.rb
View file @
80a4c808
...
@@ -111,9 +111,9 @@ module DiffHelper
...
@@ -111,9 +111,9 @@ module DiffHelper
def
diff_line_content
(
line
)
def
diff_line_content
(
line
)
if
line
.
blank?
if
line
.
blank?
" "
" "
.
html_safe
else
else
line
line
.
try
(
:html_safe
)
end
end
end
end
...
...
app/views/projects/blob/preview.html.haml
View file @
80a4c808
...
@@ -20,6 +20,6 @@
...
@@ -20,6 +20,6 @@
-
else
-
else
%td
.old_line
%td
.old_line
%td
.new_line
%td
.new_line
%td
.line_content
{
class:
"#{line.type}"
}=
raw
diff_line_content
(
line
.
text
)
%td
.line_content
{
class:
"#{line.type}"
}=
diff_line_content
(
line
.
text
)
-
else
-
else
.nothing-here-block
No changes.
.nothing-here-block
No changes.
app/views/projects/diffs/_text_file.html.haml
View file @
80a4c808
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
=
link_to_new_diff_note
(
line_code
)
=
link_to_new_diff_note
(
line_code
)
%td
.new_line
{
data:
{
linenumber:
line
.
new_pos
}}
%td
.new_line
{
data:
{
linenumber:
line
.
new_pos
}}
=
link_to
raw
(
type
==
"old"
?
" "
:
line
.
new_pos
),
"#
#{
line_code
}
"
,
id:
line_code
=
link_to
raw
(
type
==
"old"
?
" "
:
line
.
new_pos
),
"#
#{
line_code
}
"
,
id:
line_code
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
diff_line_content
(
line
.
text
)
.
html_safe
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
diff_line_content
(
line
.
text
)
-
if
@reply_allowed
-
if
@reply_allowed
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
line_code
&&
n
.
active?
}.
sort_by
(
&
:created_at
)
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
line_code
&&
n
.
active?
}.
sort_by
(
&
:created_at
)
...
...
app/views/projects/notes/discussions/_diff.html.haml
View file @
80a4c808
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
=
raw
(
type
==
"new"
?
" "
:
line
.
old_pos
)
=
raw
(
type
==
"new"
?
" "
:
line
.
old_pos
)
%td
.new_line
%td
.new_line
=
raw
(
type
==
"old"
?
" "
:
line
.
new_pos
)
=
raw
(
type
==
"old"
?
" "
:
line
.
new_pos
)
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
raw
diff_line_content
(
line
.
text
)
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
diff_line_content
(
line
.
text
)
-
if
line_code
==
note
.
line_code
-
if
line_code
==
note
.
line_code
=
render
"projects/notes/diff_notes_with_reply"
,
notes:
discussion_notes
=
render
"projects/notes/diff_notes_with_reply"
,
notes:
discussion_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