From 98aeab2848d94da55640aaf756d014e40ea01d2d Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Wed, 4 Jul 2018 01:27:27 +0200 Subject: [PATCH] Fix parallel diff lines content. --- .../javascripts/diffs/components/diff_table_cell.vue | 12 ++++++++++-- .../diffs/components/parallel_diff_table_row.vue | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/diffs/components/diff_table_cell.vue b/app/assets/javascripts/diffs/components/diff_table_cell.vue index fdefd63ced2..5b08b161114 100644 --- a/app/assets/javascripts/diffs/components/diff_table_cell.vue +++ b/app/assets/javascripts/diffs/components/diff_table_cell.vue @@ -11,6 +11,8 @@ import { LINE_HOVER_CLASS_NAME, LINE_UNFOLD_CLASS_NAME, INLINE_DIFF_VIEW_TYPE, + LINE_POSITION_LEFT, + LINE_POSITION_RIGHT, } from '../constants'; export default { @@ -65,11 +67,17 @@ export default { computed: { ...mapGetters(['isLoggedIn']), normalizedLine() { + let normalizedLine; + if (this.diffViewType === INLINE_DIFF_VIEW_TYPE) { - return this.line; + normalizedLine = this.line; + } else if (this.linePosition === LINE_POSITION_LEFT) { + normalizedLine = this.line.left; + } else if (this.linePosition === LINE_POSITION_RIGHT) { + normalizedLine = this.line.right; } - return this.lineType === OLD_LINE_TYPE ? this.line.left : this.line.right; + return normalizedLine; }, isMatchLine() { return this.normalizedLine.type === MATCH_LINE_TYPE; diff --git a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue index 9cb68971c49..eb769584d74 100644 --- a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue +++ b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue @@ -118,6 +118,7 @@ export default { :diff-file="diffFile" :line="line" :is-content-line="true" + :line-position="linePositionLeft" :line-type="parallelViewLeftLineType" :diff-view-type="parallelDiffViewType" class="line_content parallel left-side" @@ -139,6 +140,7 @@ export default { :diff-file="diffFile" :line="line" :is-content-line="true" + :line-position="linePositionRight" :line-type="line.right.type" :diff-view-type="parallelDiffViewType" class="line_content parallel right-side"