diff --git a/app/assets/javascripts/diffs/components/diff_content.vue b/app/assets/javascripts/diffs/components/diff_content.vue
index 48ba967285f..b6af49c7e2e 100644
--- a/app/assets/javascripts/diffs/components/diff_content.vue
+++ b/app/assets/javascripts/diffs/components/diff_content.vue
@@ -39,12 +39,12 @@ export default {
diff --git a/app/assets/javascripts/diffs/components/diff_table_cell.vue b/app/assets/javascripts/diffs/components/diff_table_cell.vue
index 68fe6787f9b..fdefd63ced2 100644
--- a/app/assets/javascripts/diffs/components/diff_table_cell.vue
+++ b/app/assets/javascripts/diffs/components/diff_table_cell.vue
@@ -10,6 +10,7 @@ import {
NEW_NO_NEW_LINE_TYPE,
LINE_HOVER_CLASS_NAME,
LINE_UNFOLD_CLASS_NAME,
+ INLINE_DIFF_VIEW_TYPE,
} from '../constants';
export default {
@@ -25,6 +26,11 @@ export default {
type: Object,
required: true,
},
+ diffViewType: {
+ type: String,
+ required: false,
+ default: INLINE_DIFF_VIEW_TYPE,
+ },
showCommentButton: {
type: Boolean,
required: false,
@@ -57,9 +63,9 @@ export default {
},
},
computed: {
- ...mapGetters(['isLoggedIn', 'isInlineView']),
+ ...mapGetters(['isLoggedIn']),
normalizedLine() {
- if (this.isInlineView) {
+ if (this.diffViewType === INLINE_DIFF_VIEW_TYPE) {
return this.line;
}
@@ -72,10 +78,10 @@ export default {
return this.normalizedLine.type === CONTEXT_LINE_TYPE;
},
isMetaLine() {
+ const { type } = this.normalizedLine;
+
return (
- this.normalizedLine.type === OLD_NO_NEW_LINE_TYPE ||
- this.normalizedLine.type === NEW_NO_NEW_LINE_TYPE ||
- this.normalizedLine.type === EMPTY_CELL_TYPE
+ type === OLD_NO_NEW_LINE_TYPE || type === NEW_NO_NEW_LINE_TYPE || type === EMPTY_CELL_TYPE
);
},
classNameMap() {
diff --git a/app/assets/javascripts/diffs/components/inline_diff_table_row.vue b/app/assets/javascripts/diffs/components/inline_diff_table_row.vue
new file mode 100644
index 00000000000..a2470843ca6
--- /dev/null
+++ b/app/assets/javascripts/diffs/components/inline_diff_table_row.vue
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/assets/javascripts/diffs/components/inline_diff_view.vue b/app/assets/javascripts/diffs/components/inline_diff_view.vue
index e72f85df77a..b884230fb63 100644
--- a/app/assets/javascripts/diffs/components/inline_diff_view.vue
+++ b/app/assets/javascripts/diffs/components/inline_diff_view.vue
@@ -1,12 +1,39 @@
@@ -19,7 +46,7 @@ export default {
- = 2) {
+ this.isRightHover = isHover;
} else {
- const hoveringCell = e.target.closest('td');
- const allCellsInHoveringRow = Array.from(e.currentTarget.children);
- const hoverIndex = allCellsInHoveringRow.indexOf(hoveringCell);
-
- if (hoverIndex >= 2) {
- this.isRightHover = isHover;
- } else {
- this.isLeftHover = isHover;
- }
+ this.isLeftHover = isHover;
}
},
// Prevent text selecting on both sides of parallel diff view
@@ -110,40 +97,6 @@ export default {
-
-
-
-
-
-
@@ -176,6 +131,7 @@ export default {
:is-bottom="isBottom"
:is-hover="isRightHover"
:show-comment-button="true"
+ :diff-view-type="parallelDiffViewType"
class="diff-line-num new_line"
/>
diff --git a/app/assets/javascripts/diffs/components/parallel_diff_view.vue b/app/assets/javascripts/diffs/components/parallel_diff_view.vue
index ed92b4ee249..d7280338b68 100644
--- a/app/assets/javascripts/diffs/components/parallel_diff_view.vue
+++ b/app/assets/javascripts/diffs/components/parallel_diff_view.vue
@@ -1,25 +1,53 @@
@@ -35,7 +63,7 @@ export default {
- {
- if (line.richText) {
- return trimFirstCharOfLineContent(line);
- }
-
- if (line.left) {
- Object.assign(line, { left: trimFirstCharOfLineContent(line.left) });
- }
-
- if (line.right) {
- Object.assign(line, { right: trimFirstCharOfLineContent(line.right) });
- }
-
- return line;
- });
- },
- diffLinesLength() {
- return this.normalizedDiffLines.length;
- },
- fileHash() {
- return this.diffFile.fileHash;
- },
- },
-};
diff --git a/app/assets/javascripts/diffs/store/mutation_types.js b/app/assets/javascripts/diffs/store/mutation_types.js
index 63e9239dce4..2c8e1a1466f 100644
--- a/app/assets/javascripts/diffs/store/mutation_types.js
+++ b/app/assets/javascripts/diffs/store/mutation_types.js
@@ -1,7 +1,6 @@
export const SET_BASE_CONFIG = 'SET_BASE_CONFIG';
export const SET_LOADING = 'SET_LOADING';
export const SET_DIFF_DATA = 'SET_DIFF_DATA';
-export const SET_DIFF_FILES = 'SET_DIFF_FILES';
export const SET_DIFF_VIEW_TYPE = 'SET_DIFF_VIEW_TYPE';
export const SET_MERGE_REQUEST_DIFFS = 'SET_MERGE_REQUEST_DIFFS';
export const ADD_COMMENT_FORM_LINE = 'ADD_COMMENT_FORM_LINE';
diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js
index 339a33f8b71..8aa8a114c6f 100644
--- a/app/assets/javascripts/diffs/store/mutations.js
+++ b/app/assets/javascripts/diffs/store/mutations.js
@@ -20,12 +20,6 @@ export default {
});
},
- [types.SET_DIFF_FILES](state, diffFiles) {
- Object.assign(state, {
- diffFiles: convertObjectPropsToCamelCase(diffFiles, { deep: true }),
- });
- },
-
[types.SET_MERGE_REQUEST_DIFFS](state, mergeRequestDiffs) {
Object.assign(state, {
mergeRequestDiffs: convertObjectPropsToCamelCase(mergeRequestDiffs, { deep: true }),
diff --git a/spec/javascripts/diffs/store/mutations_spec.js b/spec/javascripts/diffs/store/mutations_spec.js
index 02836fcaeea..1af49f4985c 100644
--- a/spec/javascripts/diffs/store/mutations_spec.js
+++ b/spec/javascripts/diffs/store/mutations_spec.js
@@ -24,21 +24,6 @@ describe('DiffsStoreMutations', () => {
});
});
- describe('SET_DIFF_FILES', () => {
- it('should set diff files to state', () => {
- const filePath = '/first-diff-file-path';
- const state = {};
- const diffFiles = {
- a_mode: 1,
- highlighted_diff_lines: [{ file_path: filePath }],
- };
-
- mutations[types.SET_DIFF_FILES](state, diffFiles);
- expect(state.diffFiles.aMode).toEqual(1);
- expect(state.diffFiles.highlightedDiffLines[0].filePath).toEqual(filePath);
- });
- });
-
describe('SET_DIFF_VIEW_TYPE', () => {
it('should set diff view type properly', () => {
const state = {};