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
Jérome Perrin
gitlab-ce
Commits
46e4e8f4
Commit
46e4e8f4
authored
Sep 12, 2017
by
micael.bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed InlineDiffMarker to make it html_safe its output
updated the spec
parent
a91101d0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
app/views/projects/diffs/_file_header.html.haml
app/views/projects/diffs/_file_header.html.haml
+1
-1
lib/gitlab/diff/inline_diff_marker.rb
lib/gitlab/diff/inline_diff_marker.rb
+2
-1
spec/helpers/diff_helper_spec.rb
spec/helpers/diff_helper_spec.rb
+2
-2
No files found.
app/views/projects/diffs/_file_header.html.haml
View file @
46e4e8f4
...
...
@@ -17,7 +17,7 @@
=
blob_icon
diff_file
.
b_mode
,
diff_file
.
file_path
-
if
diff_file
.
renamed_file?
-
old_path
,
new_path
=
mark_inline_diffs
(
diff_file
.
old_path
,
diff_file
.
new_path
)
.
map
(
&
:html_safe
)
-
old_path
,
new_path
=
mark_inline_diffs
(
diff_file
.
old_path
,
diff_file
.
new_path
)
%strong
.file-title-name.has-tooltip
{
data:
{
title:
diff_file
.
old_path
,
container:
'body'
}
}
=
old_path
→
...
...
lib/gitlab/diff/inline_diff_marker.rb
View file @
46e4e8f4
...
...
@@ -2,9 +2,10 @@ module Gitlab
module
Diff
class
InlineDiffMarker
<
Gitlab
::
StringRangeMarker
def
mark
(
line_inline_diffs
,
mode:
nil
)
super
(
line_inline_diffs
)
do
|
text
,
left
:,
right
:|
mark
=
super
(
line_inline_diffs
)
do
|
text
,
left
:,
right
:|
%{<span class="#{html_class_names(left, right, mode)}">#{text}</span>}
end
mark
.
html_safe
end
private
...
...
spec/helpers/diff_helper_spec.rb
View file @
46e4e8f4
...
...
@@ -136,9 +136,9 @@ describe DiffHelper do
marked_old_line
,
marked_new_line
=
mark_inline_diffs
(
old_line
,
new_line
)
expect
(
marked_old_line
).
to
eq
(
%q{abc <span class="idiff left right deletion">'def'</span>}
)
expect
(
marked_old_line
).
not_
to
be_html_safe
expect
(
marked_old_line
).
to
be_html_safe
expect
(
marked_new_line
).
to
eq
(
%q{abc <span class="idiff left right addition">"def"</span>}
)
expect
(
marked_new_line
).
not_
to
be_html_safe
expect
(
marked_new_line
).
to
be_html_safe
end
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