Merge branch 'remove-heading-space-from-diff-content' into 'master'
Remove an extra leading space from diff paste data ## What does this MR do? Remove an extra leading space from diff paste data. ## Are there points in the code the reviewer needs to double check? I have checked the following three patterns. * inline diff * parallel diff * blob preview ## Why was this MR needed? Diff paste data contain an extra leading space. So it need to remove an extra leading space manually from pasted diff data. ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [ ] Added for this feature/bug - [ ] All builds are passing - [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if it does - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? #14176 Closes #23899 See merge request !7133
This commit is contained in:
commit
35aca1dbcf
6 changed files with 28 additions and 26 deletions
|
@ -43,10 +43,6 @@
|
|||
bottom: unfoldBottom,
|
||||
offset: offset,
|
||||
unfold: unfold,
|
||||
// indent is used to compensate for single space indent to fit
|
||||
// '+' and '-' prepended to diff lines,
|
||||
// see https://gitlab.com/gitlab-org/gitlab-ce/issues/707
|
||||
indent: 1,
|
||||
view: file.data('view')
|
||||
};
|
||||
return $.get(link, params, function(response) {
|
||||
|
|
|
@ -92,20 +92,6 @@
|
|||
|
||||
&.noteable_line {
|
||||
position: relative;
|
||||
|
||||
&.old {
|
||||
&::before {
|
||||
content: '-';
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
&.new {
|
||||
&::before {
|
||||
content: '+';
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
span {
|
||||
|
@ -151,8 +137,9 @@
|
|||
.line_content {
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 0 0.5em;
|
||||
padding: 0 1.5em;
|
||||
border: none;
|
||||
position: relative;
|
||||
|
||||
&.parallel {
|
||||
display: table-cell;
|
||||
|
@ -161,6 +148,22 @@
|
|||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
|
||||
&.old {
|
||||
&::before {
|
||||
content: '-';
|
||||
position: absolute;
|
||||
left: 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
&.new {
|
||||
&::before {
|
||||
content: '+';
|
||||
position: absolute;
|
||||
left: 0.5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.text-file.diff-wrap-lines table .line_holder td span {
|
||||
|
|
|
@ -51,12 +51,11 @@ module DiffHelper
|
|||
html.html_safe
|
||||
end
|
||||
|
||||
def diff_line_content(line, line_type = nil)
|
||||
def diff_line_content(line)
|
||||
if line.blank?
|
||||
" ".html_safe
|
||||
" ".html_safe
|
||||
else
|
||||
line[0] = ' ' if %w[new old].include?(line_type)
|
||||
line
|
||||
line.sub(/^[\-+ ]/, '').html_safe
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
%a{href: "##{line_code}", data: { linenumber: link_text }}
|
||||
%td.line_content.noteable_line{ class: type, data: (diff_view_line_data(line_code, diff_file.position(line), type) unless plain) }<
|
||||
- if email
|
||||
%pre= diff_line_content(line.text, type)
|
||||
%pre= diff_line_content(line.text)
|
||||
- else
|
||||
= diff_line_content(line.text, type)
|
||||
= diff_line_content(line.text)
|
||||
|
||||
- discussions = local_assigns.fetch(:discussions, nil)
|
||||
- if discussions && !line.meta?
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Remove an extra leading space from diff paste data
|
||||
merge_request: 7133
|
||||
author: Hiroyuki Sato
|
|
@ -61,7 +61,7 @@ describe DiffHelper do
|
|||
|
||||
describe '#diff_line_content' do
|
||||
it 'returns non breaking space when line is empty' do
|
||||
expect(diff_line_content(nil)).to eq(' ')
|
||||
expect(diff_line_content(nil)).to eq(' ')
|
||||
end
|
||||
|
||||
it 'returns the line itself' do
|
||||
|
|
Loading…
Reference in a new issue