All files / app/assets/javascripts/diffs/components diff_comment_cell.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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77  7x                                                                                                                                                      
<script>
// eslint-disable-next-line no-restricted-imports
import { mapActions } from 'vuex';
import DiffDiscussionReply from './diff_discussion_reply.vue';
import DiffDiscussions from './diff_discussions.vue';
import DiffLineNoteForm from './diff_line_note_form.vue';
 
export default {
  components: {
    DiffDiscussions,
    DiffLineNoteForm,
    DiffDiscussionReply,
  },
  props: {
    line: {
      type: Object,
      required: true,
    },
    diffFileHash: {
      type: String,
      required: true,
    },
    helpPagePath: {
      type: String,
      required: false,
      default: '',
    },
    hasDraft: {
      type: Boolean,
      required: false,
      default: false,
    },
    lineRange: {
      type: Object,
      required: false,
      default: null,
    },
    linePosition: {
      type: String,
      required: false,
      default: '',
    },
  },
  methods: {
    ...mapActions('diffs', ['showCommentForm']),
  },
};
</script>
 
<template>
  <div class="content">
    <diff-discussions
      v-if="line.renderDiscussion"
      :line="line"
      :discussions="line.discussions"
      :help-page-path="helpPagePath"
    />
    <diff-discussion-reply
      v-if="!hasDraft"
      :has-form="line.hasCommentForm"
      :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"
          :range="lineRange"
          :note-target-line="line"
          :help-page-path="helpPagePath"
          :line-position="linePosition"
        />
      </template>
    </diff-discussion-reply>
  </div>
</template>