diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2018-09-03 22:56:09 +0200 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-09-07 12:25:50 +0200 |
commit | cee271ee3476fa357cbc8ba4414cad6118b04d7e (patch) | |
tree | 070d31d77b9af6de157919990f8e49dfe0dfb06d | |
parent | f8214f956883b44e9cc4835646b678ef1bc7a25c (diff) | |
download | gitlab-ce-cee271ee3476fa357cbc8ba4414cad6118b04d7e.tar.gz |
Fix for displaying left side comments when no discussion available
-rw-r--r-- | app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue | 4 | ||||
-rw-r--r-- | app/assets/javascripts/diffs/store/actions.js | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue b/app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue index 90f7fd22b5c..26417c350cb 100644 --- a/app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue +++ b/app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue @@ -57,7 +57,9 @@ export default { ); }, showRightSideCommentForm() { - return this.line.right.type && this.diffLineCommentForms[this.rightLineCode]; + return ( + this.line.right && this.line.right.type && this.diffLineCommentForms[this.rightLineCode] + ); }, className() { return (this.left && this.line.left.discussions.length > 0) || diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index 365cf61d5eb..1838394422a 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -49,12 +49,14 @@ export const assignDiscussionsToDiff = ({ state }, allLineDiscussions) => { } } - const targetInlineLine = selectedFile.highlightedDiffLines.find( - line => line.lineCode === discussions[0].line_code, - ); + if (selectedFile.highlightedDiffLines) { + const targetInlineLine = selectedFile.highlightedDiffLines.find( + line => line.lineCode === discussions[0].line_code, + ); - if (targetInlineLine) { - Object.assign(targetInlineLine, { discussions }); + if (targetInlineLine) { + Object.assign(targetInlineLine, { discussions }); + } } } } |