2017-09-14 11:01:07 +00:00
|
|
|
<script>
|
2022-03-04 18:20:01 +00:00
|
|
|
import { GlLink, GlIcon, GlSprintf } from '@gitlab/ui';
|
2019-07-08 08:26:37 +00:00
|
|
|
import { __, sprintf } from '~/locale';
|
2017-11-16 16:44:16 +00:00
|
|
|
|
2020-06-18 12:09:25 +00:00
|
|
|
const NoteableTypeText = {
|
2020-06-22 09:08:42 +00:00
|
|
|
Issue: __('issue'),
|
|
|
|
Epic: __('epic'),
|
|
|
|
MergeRequest: __('merge request'),
|
2020-06-18 12:09:25 +00:00
|
|
|
};
|
|
|
|
|
2018-10-10 07:06:25 +00:00
|
|
|
export default {
|
|
|
|
components: {
|
2020-08-24 15:10:11 +00:00
|
|
|
GlIcon,
|
2019-06-06 10:37:02 +00:00
|
|
|
GlLink,
|
2022-03-04 18:20:01 +00:00
|
|
|
GlSprintf,
|
2018-10-10 07:06:25 +00:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
isLocked: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
2018-01-05 00:18:35 +00:00
|
|
|
},
|
2018-10-10 07:06:25 +00:00
|
|
|
isConfidential: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
2017-09-14 11:01:07 +00:00
|
|
|
},
|
2020-06-18 12:09:25 +00:00
|
|
|
noteableType: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
2020-06-22 09:08:42 +00:00
|
|
|
// eslint-disable-next-line @gitlab/require-i18n-strings
|
|
|
|
default: 'Issue',
|
2020-06-18 12:09:25 +00:00
|
|
|
},
|
|
|
|
lockedNoteableDocsPath: {
|
2019-06-06 10:37:02 +00:00
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2020-06-18 12:09:25 +00:00
|
|
|
confidentialNoteableDocsPath: {
|
2019-06-06 10:37:02 +00:00
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2018-10-10 07:06:25 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
warningIcon() {
|
|
|
|
if (this.isConfidential) return 'eye-slash';
|
|
|
|
if (this.isLocked) return 'lock';
|
2017-11-16 16:44:16 +00:00
|
|
|
|
2018-10-10 07:06:25 +00:00
|
|
|
return '';
|
2017-09-14 11:01:07 +00:00
|
|
|
},
|
2018-10-10 07:06:25 +00:00
|
|
|
isLockedAndConfidential() {
|
|
|
|
return this.isConfidential && this.isLocked;
|
|
|
|
},
|
2020-06-18 12:09:25 +00:00
|
|
|
noteableTypeText() {
|
|
|
|
return NoteableTypeText[this.noteableType];
|
|
|
|
},
|
|
|
|
confidentialContextText() {
|
|
|
|
return sprintf(__('This is a confidential %{noteableTypeText}.'), {
|
|
|
|
noteableTypeText: this.noteableTypeText,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
lockedContextText() {
|
|
|
|
return sprintf(__('This %{noteableTypeText} is locked.'), {
|
|
|
|
noteableTypeText: this.noteableTypeText,
|
|
|
|
});
|
|
|
|
},
|
2018-10-10 07:06:25 +00:00
|
|
|
},
|
|
|
|
};
|
2017-09-14 11:01:07 +00:00
|
|
|
</script>
|
|
|
|
<template>
|
2020-11-24 15:09:13 +00:00
|
|
|
<div class="issuable-note-warning" data-testid="confidential-warning">
|
2020-08-24 15:10:11 +00:00
|
|
|
<gl-icon v-if="!isLockedAndConfidential" :name="warningIcon" :size="16" class="icon inline" />
|
2017-09-14 11:01:07 +00:00
|
|
|
|
2020-01-23 18:08:53 +00:00
|
|
|
<span v-if="isLockedAndConfidential" ref="lockedAndConfidential">
|
2022-03-04 18:20:01 +00:00
|
|
|
<span>
|
|
|
|
<gl-sprintf
|
|
|
|
:message="
|
|
|
|
__(
|
|
|
|
'This %{noteableTypeText} is %{confidentialLinkStart}confidential%{confidentialLinkEnd} and %{lockedLinkStart}locked%{lockedLinkEnd}.',
|
|
|
|
)
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<template #noteableTypeText>{{ noteableTypeText }}</template>
|
|
|
|
<template #confidentialLink="{ content }">
|
|
|
|
<gl-link :href="confidentialNoteableDocsPath" target="_blank">{{ content }}</gl-link>
|
|
|
|
</template>
|
|
|
|
<template #lockedLink="{ content }">
|
|
|
|
<gl-link :href="lockedNoteableDocsPath" target="_blank">{{ content }}</gl-link>
|
|
|
|
</template>
|
|
|
|
</gl-sprintf>
|
|
|
|
</span>
|
2018-11-16 20:07:38 +00:00
|
|
|
{{
|
2019-07-08 08:26:37 +00:00
|
|
|
__("People without permission will never get a notification and won't be able to comment.")
|
2018-11-16 20:07:38 +00:00
|
|
|
}}
|
2017-09-14 11:01:07 +00:00
|
|
|
</span>
|
|
|
|
|
2020-01-23 18:08:53 +00:00
|
|
|
<span v-else-if="isConfidential" ref="confidential">
|
2020-06-18 12:09:25 +00:00
|
|
|
{{ confidentialContextText }}
|
2019-06-06 10:37:02 +00:00
|
|
|
{{ __('People without permission will never get a notification.') }}
|
2020-06-18 12:09:25 +00:00
|
|
|
<gl-link :href="confidentialNoteableDocsPath" target="_blank">{{ __('Learn more') }}</gl-link>
|
2017-09-14 11:01:07 +00:00
|
|
|
</span>
|
|
|
|
|
2020-01-23 18:08:53 +00:00
|
|
|
<span v-else-if="isLocked" ref="locked">
|
2020-06-18 12:09:25 +00:00
|
|
|
{{ lockedContextText }}
|
2019-06-06 10:37:02 +00:00
|
|
|
{{ __('Only project members can comment.') }}
|
2020-06-18 12:09:25 +00:00
|
|
|
<gl-link :href="lockedNoteableDocsPath" target="_blank">{{ __('Learn more') }}</gl-link>
|
2017-09-14 11:01:07 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</template>
|