Commit 18bcb34c authored by Phil Hughes's avatar Phil Hughes

Merge branch 'jdb/fix-multiline-comment-form-reply' into 'master'

Don't show MLC form on thread replies

Closes #229596

See merge request gitlab-org/gitlab!37139
parents 4556e138 2c3c3a7a
...@@ -147,10 +147,10 @@ export default { ...@@ -147,10 +147,10 @@ export default {
return getEndLineNumber(this.lineRange); return getEndLineNumber(this.lineRange);
}, },
showMultiLineComment() { showMultiLineComment() {
if (!this.glFeatures.multilineComments) return false; if (!this.glFeatures.multilineComments || !this.discussionRoot) return false;
if (this.isEditing) return true; if (this.isEditing) return true;
return this.line && this.discussionRoot && this.startLineNumber !== this.endLineNumber; return this.line && this.startLineNumber !== this.endLineNumber;
}, },
commentLineOptions() { commentLineOptions() {
if (!this.diffFile || !this.line) return []; if (!this.diffFile || !this.line) return [];
......
---
title: Fix showing MLC form on replies
merge_request: 37139
author:
type: fixed
...@@ -34,7 +34,13 @@ describe('issue_note', () => { ...@@ -34,7 +34,13 @@ describe('issue_note', () => {
note, note,
}, },
localVue, localVue,
stubs: ['note-header', 'user-avatar-link', 'note-actions', 'note-body'], stubs: [
'note-header',
'user-avatar-link',
'note-actions',
'note-body',
'multiline-comment-form',
],
}); });
}); });
...@@ -77,6 +83,24 @@ describe('issue_note', () => { ...@@ -77,6 +83,24 @@ describe('issue_note', () => {
}); });
}); });
it('should render multiline comment if editing discussion root', () => {
wrapper.setProps({ discussionRoot: true });
wrapper.vm.isEditing = true;
return wrapper.vm.$nextTick().then(() => {
expect(findMultilineComment().exists()).toBe(true);
});
});
it('should not render multiline comment form unless it is the discussion root', () => {
wrapper.setProps({ discussionRoot: false });
wrapper.vm.isEditing = true;
return wrapper.vm.$nextTick().then(() => {
expect(findMultilineComment().exists()).toBe(false);
});
});
it('should not render if has single line comment', () => { it('should not render if has single line comment', () => {
const position = { const position = {
line_range: { line_range: {
......
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