2021-03-08 18:12:59 +05:30
|
|
|
<script>
|
2023-04-23 21:23:45 +05:30
|
|
|
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
2021-03-08 18:12:59 +05:30
|
|
|
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';
|
2023-04-23 21:23:45 +05:30
|
|
|
import AttachmentsWarning from './attachments_warning.vue';
|
2021-03-08 18:12:59 +05:30
|
|
|
|
|
|
|
const DEFAULT_NOTEABLE_TYPE = 'Issue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2023-04-23 21:23:45 +05:30
|
|
|
AttachmentsWarning,
|
2021-03-08 18:12:59 +05:30
|
|
|
EmailParticipantsWarning,
|
|
|
|
NoteableWarning,
|
|
|
|
},
|
2023-04-23 21:23:45 +05:30
|
|
|
mixins: [glFeatureFlagsMixin()],
|
2021-03-08 18:12:59 +05:30
|
|
|
props: {
|
|
|
|
noteableData: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2022-07-23 23:45:48 +05:30
|
|
|
isInternalNote: {
|
2021-10-27 15:23:28 +05:30
|
|
|
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,
|
|
|
|
},
|
2023-04-23 21:23:45 +05:30
|
|
|
containsLink: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
},
|
|
|
|
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() {
|
2022-07-23 23:45:48 +05:30
|
|
|
return this.emailParticipants.length && !this.isInternalNote;
|
2021-10-27 15:23:28 +05:30
|
|
|
},
|
2023-04-23 21:23:45 +05:30
|
|
|
showAttachmentWarning() {
|
|
|
|
return (
|
|
|
|
this.glFeatures.serviceDeskNewNoteEmailNativeAttachments &&
|
|
|
|
this.showEmailParticipantsWarning &&
|
|
|
|
this.containsLink
|
|
|
|
);
|
|
|
|
},
|
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"
|
2023-05-27 22:25:52 +05:30
|
|
|
class="gl-py-4 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"
|
2021-03-08 18:12:59 +05:30
|
|
|
: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>
|
2023-04-23 21:23:45 +05:30
|
|
|
<attachments-warning v-if="showAttachmentWarning" />
|
2021-03-08 18:12:59 +05:30
|
|
|
<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>
|