Commit 13682301 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/255626/allowMultipleCommentsInInlineView' into 'master'

Fixed an issue that stop multiple comments being added to same line

See merge request gitlab-org/gitlab!52111
parents f21b97a2 504ba1b2
...@@ -61,10 +61,10 @@ export default { ...@@ -61,10 +61,10 @@ export default {
...mapActions(['setSelectedCommentPosition']), ...mapActions(['setSelectedCommentPosition']),
...mapActions('diffs', ['showCommentForm']), ...mapActions('diffs', ['showCommentForm']),
showCommentLeft(line) { showCommentLeft(line) {
return !this.inline || line.left; return line.left && !line.right;
}, },
showCommentRight(line) { showCommentRight(line) {
return !this.inline || (line.right && !line.left); return line.right && !line.left;
}, },
onStartDragging(line) { onStartDragging(line) {
this.dragStart = line; this.dragStart = line;
...@@ -138,24 +138,20 @@ export default { ...@@ -138,24 +138,20 @@ export default {
:class="line.commentRowClasses" :class="line.commentRowClasses"
class="diff-grid-comments diff-tr notes_holder" class="diff-grid-comments diff-tr notes_holder"
> >
<div v-if="showCommentLeft(line)" class="diff-td notes-content parallel old"> <div v-if="line.left" :class="{ parallel: !inline }" class="diff-td notes-content old">
<diff-comment-cell <diff-comment-cell
v-if="line.left"
:line="line.left" :line="line.left"
:diff-file-hash="diffFile.file_hash" :diff-file-hash="diffFile.file_hash"
:help-page-path="helpPagePath" :help-page-path="helpPagePath"
:has-draft="line.left.hasDraft"
line-position="left" line-position="left"
/> />
</div> </div>
<div v-if="showCommentRight(line)" class="diff-td notes-content parallel new"> <div v-if="line.right" :class="{ parallel: !inline }" class="diff-td notes-content new">
<diff-comment-cell <diff-comment-cell
v-if="line.right"
:line="line.right" :line="line.right"
:diff-file-hash="diffFile.file_hash" :diff-file-hash="diffFile.file_hash"
:line-index="index" :line-index="index"
:help-page-path="helpPagePath" :help-page-path="helpPagePath"
:has-draft="line.right.hasDraft"
line-position="right" line-position="right"
/> />
</div> </div>
......
---
title: Allow multiple comments on diff lines in inline view
merge_request: 52111
author:
type: fixed
...@@ -59,8 +59,8 @@ describe('DiffView', () => { ...@@ -59,8 +59,8 @@ describe('DiffView', () => {
${'parallel'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} }, right: { lineDraft: {} } }} | ${2} ${'parallel'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} }, right: { lineDraft: {} } }} | ${2}
${'parallel'} | ${'right'} | ${'.new'} | ${{ left: { lineDraft: {} }, right: { lineDraft: {} } }} | ${2} ${'parallel'} | ${'right'} | ${'.new'} | ${{ left: { lineDraft: {} }, right: { lineDraft: {} } }} | ${2}
${'inline'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} } }} | ${1} ${'inline'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} } }} | ${1}
${'inline'} | ${'right'} | ${'.new'} | ${{ right: { lineDraft: {} } }} | ${1} ${'inline'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} } }} | ${1}
${'inline'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} }, right: { lineDraft: {} } }} | ${1} ${'inline'} | ${'left'} | ${'.old'} | ${{ left: { lineDraft: {} } }} | ${1}
`( `(
'renders a $type comment row with comment cell on $side', 'renders a $type comment row with comment cell on $side',
({ type, container, sides, total }) => { ({ type, container, sides, total }) => {
......
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