All files / app/assets/javascripts/diffs/components diff_discussion_reply.vue

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51    8x                                                                                                
<script>
import { GlButton } from '@gitlab/ui';
// eslint-disable-next-line no-restricted-imports
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>