debian-mirror-gitlab/app/assets/javascripts/sidebar/components/assignees/sidebar_participant.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
1.4 KiB
Vue
Raw Normal View History

2021-04-29 21:17:54 +05:30
<script>
2022-08-27 11:52:29 +05:30
import { GlAvatarLabeled, GlIcon } from '@gitlab/ui';
2023-04-23 21:23:45 +05:30
import { IssuableType, TYPE_ISSUE } from '~/issues/constants';
2021-04-29 21:17:54 +05:30
import { s__, sprintf } from '~/locale';
2022-07-16 23:28:13 +05:30
const AVAILABILITY_STATUS = {
NOT_SET: 'NOT_SET',
BUSY: 'BUSY',
};
2021-04-29 21:17:54 +05:30
export default {
components: {
GlAvatarLabeled,
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,
2023-04-23 21:23:45 +05:30
default: TYPE_ISSUE,
2022-05-07 20:08:51 +05:30
},
2021-04-29 21:17:54 +05:30
},
computed: {
userLabel() {
2022-07-16 23:28:13 +05:30
const { name, status } = this.user;
if (!status || status?.availability !== AVAILABILITY_STATUS.BUSY) {
return name;
2021-04-29 21:17:54 +05:30
}
2022-07-16 23:28:13 +05:30
return sprintf(
s__('UserAvailability|%{author} (Busy)'),
{
author: name,
},
false,
);
2021-04-29 21:17:54 +05:30
},
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>
2022-08-27 11:52:29 +05:30
<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"
2022-11-25 23:54:43 +05:30
class="merge-icon"
2022-08-27 11:52:29 +05:30
:size="12"
/>
</template>
</gl-avatar-labeled>
2021-04-29 21:17:54 +05:30
</template>