From b8b2cb3675a38fa0460add7a1cab03abbaeb56fd Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Sat, 1 Sep 2018 23:24:29 +0200 Subject: Fixed Problems with Inline View + Specs --- .../diffs/components/diff_line_gutter_content.vue | 6 +++--- .../diffs/components/inline_diff_comment_row.vue | 11 +++-------- .../diffs/components/inline_diff_table_row.vue | 7 ------- .../diffs/components/inline_diff_view.vue | 21 +++------------------ .../diffs/components/parallel_diff_table_row.vue | 1 - .../diffs/components/parallel_diff_view.vue | 7 ------- 6 files changed, 9 insertions(+), 44 deletions(-) (limited to 'app/assets/javascripts/diffs/components') diff --git a/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue b/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue index f1299408904..92891b37c1e 100644 --- a/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue +++ b/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue @@ -78,7 +78,7 @@ export default { }), ...mapGetters(['isLoggedIn']), lineHref() { - return this.line.code ? `#${this.line.code}` : '#'; + return this.line && this.line.code ? `#${this.line.code}` : '#'; }, shouldShowCommentButton() { return ( @@ -92,10 +92,10 @@ export default { ); }, hasDiscussions() { - return this.line.discussions && this.line.discussions.length > 0; + return this.line && this.line.discussions && this.line.discussions.length > 0; }, shouldShowAvatarsOnGutter() { - if (!this.line.type && this.linePosition === LINE_POSITION_RIGHT) { + if (this.line && !this.line.type && this.linePosition === LINE_POSITION_RIGHT) { return false; } diff --git a/app/assets/javascripts/diffs/components/inline_diff_comment_row.vue b/app/assets/javascripts/diffs/components/inline_diff_comment_row.vue index 6348f32d36d..46a51859da5 100644 --- a/app/assets/javascripts/diffs/components/inline_diff_comment_row.vue +++ b/app/assets/javascripts/diffs/components/inline_diff_comment_row.vue @@ -21,18 +21,13 @@ export default { type: Number, required: true, }, - discussions: { - type: Array, - required: false, - default: () => [], - }, }, computed: { ...mapState({ diffLineCommentForms: state => state.diffs.diffLineCommentForms, }), className() { - return this.discussions.length ? '' : 'js-temp-notes-holder'; + return this.line.discussions.length ? '' : 'js-temp-notes-holder'; }, }, }; @@ -49,8 +44,8 @@ export default { >
[], - }, }, data() { return { @@ -94,7 +89,6 @@ export default { :is-bottom="isBottom" :is-hover="isHover" :show-comment-button="true" - :discussions="discussions" class="diff-line-num old_line" /> state.diffs.diffLineCommentForms, }), - normalizedDiffLines() { - return this.diffLines.map(line => (line.richText ? trimFirstCharOfLineContent(line) : line)); - }, diffLinesLength() { - return this.normalizedDiffLines.length; + return this.diffLines.length; }, userColorScheme() { return window.gon.user_color_scheme; }, }, - methods: { - discussionsList(line) { - return line.lineCode !== undefined ? this.singleDiscussionByLineCode(line.lineCode) : []; - }, - }, }; @@ -53,7 +40,7 @@ export default { class="code diff-wrap-lines js-syntax-highlight text-file js-diff-inline-view"> 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 38c6458a14e..fb68d191091 100644 --- a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue +++ b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue @@ -1,6 +1,5 @@ -- cgit v1.2.1