Commit d6cc7c98 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/332574/fixDiffRefsErrorReplyActions' into 'master'

Hide discussion actions when diff_refs dont exist

See merge request gitlab-org/gitlab!63414
parents ac90d4cd 13f8aa53
...@@ -135,6 +135,13 @@ export default { ...@@ -135,6 +135,13 @@ export default {
resolveWithIssuePath() { resolveWithIssuePath() {
return !this.discussionResolved ? this.discussion.resolve_with_issue_path : ''; return !this.discussionResolved ? this.discussion.resolve_with_issue_path : '';
}, },
canShowReplyActions() {
if (this.shouldRenderDiffs && !this.discussion.diff_file.diff_refs) {
return false;
}
return true;
},
}, },
created() { created() {
eventHub.$on('startReplying', this.onStartReplying); eventHub.$on('startReplying', this.onStartReplying);
...@@ -263,7 +270,7 @@ export default { ...@@ -263,7 +270,7 @@ export default {
:draft="draftForDiscussion(discussion.reply_id)" :draft="draftForDiscussion(discussion.reply_id)"
/> />
<div <div
v-else-if="showReplies" v-else-if="canShowReplyActions && showReplies"
:class="{ 'is-replying': isReplying }" :class="{ 'is-replying': isReplying }"
class="discussion-reply-holder gl-border-t-0! clearfix" class="discussion-reply-holder gl-border-t-0! clearfix"
> >
......
...@@ -56,6 +56,18 @@ describe('noteable_discussion component', () => { ...@@ -56,6 +56,18 @@ describe('noteable_discussion component', () => {
expect(wrapper.find('.discussion-header').exists()).toBe(true); expect(wrapper.find('.discussion-header').exists()).toBe(true);
}); });
it('should hide actions when diff refs do not exists', async () => {
const discussion = { ...discussionMock };
discussion.diff_file = { ...mockDiffFile, diff_refs: null };
discussion.diff_discussion = true;
discussion.expanded = false;
wrapper.setProps({ discussion });
await nextTick();
expect(wrapper.vm.canShowReplyActions).toBe(false);
});
describe('actions', () => { describe('actions', () => {
it('should toggle reply form', async () => { it('should toggle reply form', async () => {
await nextTick(); await nextTick();
......
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