debian-mirror-gitlab/app/assets/javascripts/diffs/components/diff_discussion_reply.vue
2023-03-04 22:38:38 +05:30

49 lines
1.1 KiB
Vue

<script>
import { GlButton } from '@gitlab/ui';
import { mapGetters } from 'vuex';
import NoteSignedOutWidget from '~/notes/components/note_signed_out_widget.vue';
import { START_THREAD } from '../i18n';
export default {
name: 'DiffDiscussionReply',
i18n: {
START_THREAD,
},
components: {
GlButton,
NoteSignedOutWidget,
},
props: {
hasForm: {
type: Boolean,
required: false,
default: false,
},
renderReplyPlaceholder: {
type: Boolean,
required: true,
},
},
computed: {
...mapGetters({
currentUser: 'getUserData',
userCanReply: 'userCanReply',
}),
},
};
</script>
<template>
<div class="discussion-reply-holder d-flex clearfix">
<template v-if="userCanReply">
<slot v-if="hasForm" name="form"></slot>
<template v-else-if="renderReplyPlaceholder">
<gl-button @click="$emit('showNewDiscussionForm')">
{{ $options.i18n.START_THREAD }}
</gl-button>
</template>
</template>
<note-signed-out-widget v-else />
</div>
</template>