2021-04-29 21:17:54 +05:30
|
|
|
<script>
|
2022-05-07 20:08:51 +05:30
|
|
|
import { GlAvatarLabeled, GlAvatarLink, GlIcon } from '@gitlab/ui';
|
|
|
|
import { IssuableType } from '~/issues/constants';
|
2021-04-29 21:17:54 +05:30
|
|
|
import { s__, sprintf } from '~/locale';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
GlAvatarLabeled,
|
|
|
|
GlAvatarLink,
|
2022-05-07 20:08:51 +05:30
|
|
|
GlIcon,
|
2021-04-29 21:17:54 +05:30
|
|
|
},
|
|
|
|
props: {
|
|
|
|
user: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2022-05-07 20:08:51 +05:30
|
|
|
issuableType: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: IssuableType.Issue,
|
|
|
|
},
|
2021-04-29 21:17:54 +05:30
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
userLabel() {
|
|
|
|
if (!this.user.status) {
|
|
|
|
return this.user.name;
|
|
|
|
}
|
|
|
|
return sprintf(s__('UserAvailability|%{author} (Busy)'), {
|
|
|
|
author: this.user.name,
|
|
|
|
});
|
|
|
|
},
|
2022-05-07 20:08:51 +05:30
|
|
|
hasCannotMergeIcon() {
|
|
|
|
return this.issuableType === IssuableType.MergeRequest && !this.user.canMerge;
|
|
|
|
},
|
2021-04-29 21:17:54 +05:30
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<gl-avatar-link>
|
|
|
|
<gl-avatar-labeled
|
|
|
|
:size="32"
|
|
|
|
:label="userLabel"
|
2022-05-07 20:08:51 +05:30
|
|
|
:sub-label="`@${user.username}`"
|
2021-04-29 21:17:54 +05:30
|
|
|
:src="user.avatarUrl || user.avatar || user.avatar_url"
|
2022-05-07 20:08:51 +05:30
|
|
|
class="gl-align-items-center gl-relative"
|
|
|
|
>
|
|
|
|
<template #meta>
|
|
|
|
<gl-icon
|
|
|
|
v-if="hasCannotMergeIcon"
|
|
|
|
name="warning-solid"
|
|
|
|
aria-hidden="true"
|
|
|
|
class="merge-icon"
|
|
|
|
:size="12"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</gl-avatar-labeled>
|
2021-04-29 21:17:54 +05:30
|
|
|
</gl-avatar-link>
|
|
|
|
</template>
|