Commit bf0b712e authored by Phil Hughes's avatar Phil Hughes Committed by Kushal Pandya

Expand collapsed discussion when replying

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/235529
parent c4f7ce7d
...@@ -149,9 +149,14 @@ export default { ...@@ -149,9 +149,14 @@ export default {
'removePlaceholderNotes', 'removePlaceholderNotes',
'toggleResolveNote', 'toggleResolveNote',
'removeConvertedDiscussion', 'removeConvertedDiscussion',
'expandDiscussion',
]), ]),
showReplyForm() { showReplyForm() {
this.isReplying = true; this.isReplying = true;
if (!this.discussion.expanded) {
this.expandDiscussion({ discussionId: this.discussion.id });
}
}, },
cancelReplyForm(shouldConfirm, isDirty) { cancelReplyForm(shouldConfirm, isDirty) {
if (shouldConfirm && isDirty) { if (shouldConfirm && isDirty) {
......
---
title: Fixed discussion not expanding when replying to a collapsed discussion
merge_request: 39571
author:
type: fixed
...@@ -89,6 +89,23 @@ describe('noteable_discussion component', () => { ...@@ -89,6 +89,23 @@ describe('noteable_discussion component', () => {
}); });
}); });
it('should expand discussion', async () => {
const expandDiscussion = jest.fn();
const discussion = { ...discussionMock };
discussion.expanded = false;
wrapper.setProps({ discussion });
wrapper.setMethods({ expandDiscussion });
await wrapper.vm.$nextTick();
wrapper.vm.showReplyForm();
await wrapper.vm.$nextTick();
expect(expandDiscussion).toHaveBeenCalledWith({ discussionId: discussion.id });
});
it('does not render jump to thread button', () => { it('does not render jump to thread button', () => {
expect(wrapper.find('*[data-original-title="Jump to next unresolved thread"]').exists()).toBe( expect(wrapper.find('*[data-original-title="Jump to next unresolved thread"]').exists()).toBe(
false, false,
......
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