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
|
<script>
import { n__, sprintf } from '~/locale';
import { toNounSeriesText } from '~/lib/utils/grammar';
import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue';
import { APPROVED_MESSAGE } from '~/vue_merge_request_widget/components/approvals/messages';
export default {
components: {
UserAvatarList,
},
props: {
approved: {
type: Boolean,
required: true,
},
approvalsLeft: {
type: Number,
required: true,
},
rulesLeft: {
type: Array,
required: false,
default: () => [],
},
approvers: {
type: Array,
required: false,
default: () => [],
},
},
computed: {
message() {
if (this.approved) {
return APPROVED_MESSAGE;
}
if (!this.rulesLeft.length) {
return n__('Requires approval.', 'Requires %d more approvals.', this.approvalsLeft);
}
return sprintf(
n__(
'Requires approval from %{names}.',
'Requires %{count} more approvals from %{names}.',
this.approvalsLeft,
),
{
names: toNounSeriesText(this.rulesLeft),
count: this.approvalsLeft,
},
false,
);
},
hasApprovers() {
return Boolean(this.approvers.length);
},
},
APPROVED_MESSAGE,
};
</script>
<template>
<div data-qa-selector="approvals_summary_content">
<strong>{{ message }}</strong>
<template v-if="hasApprovers">
<span>{{ s__('mrWidget|Approved by') }}</span>
<user-avatar-list class="d-inline-block align-middle" :items="approvers" />
</template>
</div>
</template>
|