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

58 lines
1.3 KiB
Vue
Raw Normal View History

2019-12-04 20:38:33 +05:30
<script>
2021-02-22 17:27:13 +05:30
import { GlIcon } from '@gitlab/ui';
2022-05-07 20:08:51 +05:30
import { IssuableType } from '~/issues/constants';
2019-12-04 20:38:33 +05:30
import { __, sprintf } from '~/locale';
export default {
2021-02-22 17:27:13 +05:30
components: {
GlIcon,
},
2019-12-04 20:38:33 +05:30
props: {
user: {
type: Object,
required: true,
},
imgSize: {
type: Number,
required: true,
},
issuableType: {
type: String,
required: false,
default: 'issue',
},
},
computed: {
assigneeAlt() {
return sprintf(__("%{userName}'s avatar"), { userName: this.user.name });
},
avatarUrl() {
2021-01-29 00:20:46 +05:30
return (
this.user.avatarUrl || this.user.avatar || this.user.avatar_url || gon.default_avatar_url
);
2019-12-04 20:38:33 +05:30
},
isMergeRequest() {
2022-05-07 20:08:51 +05:30
return this.issuableType === IssuableType.MergeRequest;
2019-12-04 20:38:33 +05:30
},
hasMergeIcon() {
2022-05-07 20:08:51 +05:30
const canMerge = this.user.mergeRequestInteraction?.canMerge || this.user.can_merge;
return this.isMergeRequest && !canMerge;
2019-12-04 20:38:33 +05:30
},
},
};
</script>
<template>
<span class="position-relative">
<img
:alt="assigneeAlt"
:src="avatarUrl"
:width="imgSize"
:class="`s${imgSize}`"
class="avatar avatar-inline m-0"
2019-12-21 20:55:43 +05:30
data-qa-selector="avatar_image"
2019-12-04 20:38:33 +05:30
/>
2021-02-22 17:27:13 +05:30
<gl-icon v-if="hasMergeIcon" name="warning-solid" aria-hidden="true" class="merge-icon" />
2019-12-04 20:38:33 +05:30
</span>
</template>