Commit 54bb6f3d authored by Phil Hughes's avatar Phil Hughes

Allow multiple comments on the same diff line

This issue occurs when the unified diff components
feature flag is enabled.

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