debian-mirror-gitlab/app/assets/javascripts/notes/components/comment_field_layout.vue

78 lines
2.1 KiB
Vue
Raw Normal View History

2021-03-08 18:12:59 +05:30
<script>
import NoteableWarning from '~/vue_shared/components/notes/noteable_warning.vue';
2021-03-11 19:13:27 +05:30
import EmailParticipantsWarning from './email_participants_warning.vue';
2021-03-08 18:12:59 +05:30
const DEFAULT_NOTEABLE_TYPE = 'Issue';
export default {
components: {
EmailParticipantsWarning,
NoteableWarning,
},
props: {
noteableData: {
type: Object,
required: true,
},
2021-10-27 15:23:28 +05:30
noteIsConfidential: {
type: Boolean,
required: false,
default: false,
},
2021-03-08 18:12:59 +05:30
noteableType: {
type: String,
required: false,
default: DEFAULT_NOTEABLE_TYPE,
},
withAlertContainer: {
type: Boolean,
required: false,
default: false,
},
},
computed: {
isLocked() {
return Boolean(this.noteableData.discussion_locked);
},
isConfidential() {
return Boolean(this.noteableData.confidential);
},
hasWarning() {
return this.isConfidential || this.isLocked;
},
emailParticipants() {
return this.noteableData.issue_email_participants?.map(({ email }) => email) || [];
},
2021-10-27 15:23:28 +05:30
showEmailParticipantsWarning() {
return this.emailParticipants.length && !this.noteIsConfidential;
},
2021-03-08 18:12:59 +05:30
},
};
</script>
<template>
<div
class="comment-warning-wrapper gl-border-solid gl-border-1 gl-rounded-base gl-border-gray-100"
>
<div
v-if="withAlertContainer"
class="error-alert"
data-testid="comment-field-alert-container"
></div>
<noteable-warning
v-if="hasWarning"
class="gl-border-b-1 gl-border-b-solid gl-border-b-gray-100 gl-rounded-base gl-rounded-bottom-left-none gl-rounded-bottom-right-none"
:is-locked="isLocked"
:is-confidential="isConfidential"
:noteable-type="noteableType"
:locked-noteable-docs-path="noteableData.locked_discussion_docs_path"
:confidential-noteable-docs-path="noteableData.confidential_issues_docs_path"
/>
<slot></slot>
<email-participants-warning
2021-10-27 15:23:28 +05:30
v-if="showEmailParticipantsWarning"
2021-03-08 18:12:59 +05:30
class="gl-border-t-1 gl-border-t-solid gl-border-t-gray-100 gl-rounded-base gl-rounded-top-left-none! gl-rounded-top-right-none!"
:emails="emailParticipants"
/>
</div>
</template>