Commit 0eb13627 authored by Fernando's avatar Fernando

Maintainer feedback changes

* Tweak styles
* Refactor diff_utils
parent f5aa8ce3
...@@ -36,13 +36,13 @@ export default { ...@@ -36,13 +36,13 @@ export default {
return this.diffData.filter(this.shouldShowLine); return this.diffData.filter(this.shouldShowLine);
}, },
isDiffView() { isDiffView() {
return this.view === VIEW_TYPES.DIFF; return this.view === this.$options.viewTypes.DIFF;
}, },
isBeforeView() { isBeforeView() {
return this.view === VIEW_TYPES.BEFORE; return this.view === this.$options.viewTypes.BEFORE;
}, },
isAfterView() { isAfterView() {
return this.view === VIEW_TYPES.AFTER; return this.view === this.$options.viewTypes.AFTER;
}, },
}, },
methods: { methods: {
...@@ -110,10 +110,10 @@ export default { ...@@ -110,10 +110,10 @@ export default {
class="line_holder" class="line_holder"
data-testid="diffLine" data-testid="diffLine"
> >
<td class="diff-line-num old_line gl-border-t-0 gl-border-b-0" :class="changeClass(line)"> <td class="diff-line-num gl-border-t-0 gl-border-b-0" :class="changeClass(line)">
{{ line.oldLine }} {{ line.oldLine }}
</td> </td>
<td class="diff-line-num new_line gl-border-t-0 gl-border-b-0" :class="changeClass(line)"> <td class="diff-line-num gl-border-t-0 gl-border-b-0" :class="changeClass(line)">
{{ line.newLine }} {{ line.newLine }}
</td> </td>
<td data-testid="diffContent" class="line_content" :class="changeClass(line)"> <td data-testid="diffContent" class="line_content" :class="changeClass(line)">
......
...@@ -8,11 +8,11 @@ import { LINE_TYPES } from './constants'; ...@@ -8,11 +8,11 @@ import { LINE_TYPES } from './constants';
export function splitAction(action) { export function splitAction(action) {
const splitValues = action.value.split(/(\n)/); const splitValues = action.value.split(/(\n)/);
if (
splitValues.length >= 2 && const isEmptyCharacter = splitValues[splitValues.length - 1] === '';
splitValues[splitValues.length - 1] === '' && const isNewLine = splitValues[splitValues.length - 2] === '\n';
splitValues[splitValues.length - 2] === '\n'
) { if (splitValues.length >= 2 && isEmptyCharacter && isNewLine) {
splitValues.pop(); splitValues.pop();
} }
return splitValues.map((splitValue) => ({ return splitValues.map((splitValue) => ({
...@@ -110,14 +110,12 @@ function splitLinesInline(lines) { ...@@ -110,14 +110,12 @@ function splitLinesInline(lines) {
export function groupActionsByLines(actions) { export function groupActionsByLines(actions) {
const res = []; const res = [];
let currLine = null; let currLine = { actions: [] };
const newLine = () => { const newLine = () => {
if (currLine !== null) {
res.push(currLine); res.push(currLine);
}
currLine = { actions: [] }; currLine = { actions: [] };
}; };
newLine();
actions.forEach((action) => { actions.forEach((action) => {
if (action.added) { if (action.added) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment