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 { GlAvatarLabeled, GlIcon } from '@gitlab/ui';
import { TYPE_ISSUE, TYPE_MERGE_REQUEST } from '~/issues/constants';
import { s__, sprintf } from '~/locale';
const AVAILABILITY_STATUS = {
NOT_SET: 'NOT_SET',
BUSY: 'BUSY',
};
export default {
components: {
GlAvatarLabeled,
GlIcon,
},
props: {
user: {
type: Object,
required: true,
},
issuableType: {
type: String,
required: false,
default: TYPE_ISSUE,
},
},
computed: {
userLabel() {
const { name, status } = this.user;
if (!status || status?.availability !== AVAILABILITY_STATUS.BUSY) {
return name;
}
return sprintf(
s__('UserAvailability|%{author} (Busy)'),
{
author: name,
},
false,
);
},
hasCannotMergeIcon() {
return this.issuableType === TYPE_MERGE_REQUEST && !this.user.canMerge;
},
},
};
</script>
<template>
<gl-avatar-labeled
:size="32"
:label="userLabel"
:sub-label="`@${user.username}`"
:src="user.avatarUrl || user.avatar || user.avatar_url"
class="gl-align-items-center gl-relative sidebar-participant"
>
<template #meta>
<gl-icon
v-if="hasCannotMergeIcon"
name="warning-solid"
aria-hidden="true"
class="merge-icon"
:size="12"
/>
</template>
</gl-avatar-labeled>
</template>
|