2018-06-27 21:20:41 +00:00
|
|
|
<script>
|
2019-07-03 08:26:57 +00:00
|
|
|
import { mapActions } from 'vuex';
|
|
|
|
import DiffDiscussions from './diff_discussions.vue';
|
|
|
|
import DiffLineNoteForm from './diff_line_note_form.vue';
|
|
|
|
import DiffDiscussionReply from './diff_discussion_reply.vue';
|
2018-06-27 21:20:41 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2019-07-03 08:26:57 +00:00
|
|
|
DiffDiscussions,
|
|
|
|
DiffLineNoteForm,
|
|
|
|
DiffDiscussionReply,
|
2018-06-27 21:20:41 +00:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
line: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2018-07-17 15:47:02 +00:00
|
|
|
diffFileHash: {
|
|
|
|
type: String,
|
2018-06-27 21:20:41 +00:00
|
|
|
required: true,
|
|
|
|
},
|
2018-12-13 19:17:19 +00:00
|
|
|
helpPagePath: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2019-07-08 09:49:48 +00:00
|
|
|
hasDraft: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
2018-06-27 21:20:41 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
className() {
|
2018-09-01 21:24:29 +00:00
|
|
|
return this.line.discussions.length ? '' : 'js-temp-notes-holder';
|
2018-06-27 21:20:41 +00:00
|
|
|
},
|
2018-11-09 09:44:07 +00:00
|
|
|
shouldRender() {
|
|
|
|
if (this.line.hasForm) return true;
|
|
|
|
|
|
|
|
if (!this.line.discussions || !this.line.discussions.length) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-07-03 08:26:57 +00:00
|
|
|
return this.line.discussionsExpanded;
|
2018-11-09 09:44:07 +00:00
|
|
|
},
|
2018-06-27 21:20:41 +00:00
|
|
|
},
|
2019-07-03 08:26:57 +00:00
|
|
|
methods: {
|
|
|
|
...mapActions('diffs', ['showCommentForm']),
|
|
|
|
},
|
2018-06-27 21:20:41 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2018-11-09 09:44:07 +00:00
|
|
|
<tr v-if="shouldRender" :class="className" class="notes_holder">
|
2020-03-17 18:09:44 +00:00
|
|
|
<td class="notes-content" colspan="4">
|
2018-06-27 21:20:41 +00:00
|
|
|
<div class="content">
|
2018-12-13 19:17:19 +00:00
|
|
|
<diff-discussions
|
|
|
|
v-if="line.discussions.length"
|
|
|
|
:line="line"
|
|
|
|
:discussions="line.discussions"
|
|
|
|
:help-page-path="helpPagePath"
|
|
|
|
/>
|
2019-07-03 08:26:57 +00:00
|
|
|
<diff-discussion-reply
|
2019-07-08 09:49:48 +00:00
|
|
|
v-if="!hasDraft"
|
2019-07-03 08:26:57 +00:00
|
|
|
:has-form="line.hasForm"
|
|
|
|
:render-reply-placeholder="Boolean(line.discussions.length)"
|
|
|
|
@showNewDiscussionForm="
|
|
|
|
showCommentForm({ lineCode: line.line_code, fileHash: diffFileHash })
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<template #form>
|
|
|
|
<diff-line-note-form
|
|
|
|
:diff-file-hash="diffFileHash"
|
|
|
|
:line="line"
|
|
|
|
:note-target-line="line"
|
|
|
|
:help-page-path="helpPagePath"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</diff-discussion-reply>
|
2018-06-27 21:20:41 +00:00
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</template>
|