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
|
<script>
import { GlLink, GlIcon } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
import { helpPagePath } from '~/helpers/help_page_helper';
import { TASK_TYPE_NAME } from '~/work_items/constants';
export default {
components: {
GlIcon,
GlLink,
},
props: {
workItemType: {
required: false,
type: String,
default: TASK_TYPE_NAME,
},
isProjectArchived: {
required: false,
type: Boolean,
default: false,
},
},
constantOptions: {
archivedProjectDocsPath: helpPagePath('user/project/settings/index.md', {
anchor: 'archive-a-project',
}),
lockedIssueDocsPath: helpPagePath('user/discussions/index.md', {
anchor: 'prevent-comments-by-locking-the-discussion',
}),
projectArchivedWarning: __('This project is archived and cannot be commented on.'),
},
computed: {
issuableDisplayName() {
return this.workItemType.replace(/_/g, ' ');
},
lockedIssueWarning() {
return sprintf(
__('This %{issuableDisplayName} is locked. Only project members can comment.'),
{ issuableDisplayName: this.issuableDisplayName },
);
},
},
};
</script>
<template>
<div class="disabled-comment text-center">
<span class="issuable-note-warning gl-display-inline-block">
<gl-icon name="lock" class="gl-mr-2" />
<template v-if="isProjectArchived">
{{ $options.constantOptions.projectArchivedWarning }}
<gl-link :href="$options.constantOptions.archivedProjectDocsPath" class="learn-more">
{{ __('Learn more') }}
</gl-link>
</template>
<template v-else>
{{ lockedIssueWarning }}
<gl-link :href="$options.constantOptions.lockedIssueDocsPath" class="learn-more">
{{ __('Learn more') }}
</gl-link>
</template>
</span>
</div>
</template>
|