debian-mirror-gitlab/app/assets/javascripts/sidebar/components/reviewers/reviewer_avatar.vue

48 lines
1.1 KiB
Vue
Raw Normal View History

2021-01-03 14:25:43 +05:30
<script>
// NOTE! For the first iteration, we are simply copying the implementation of Assignees
// It will soon be overhauled in Issue https://gitlab.com/gitlab-org/gitlab/-/issues/233736
2021-02-22 17:27:13 +05:30
import { GlIcon } from '@gitlab/ui';
2021-01-03 14:25:43 +05:30
import { __, sprintf } from '~/locale';
export default {
2021-02-22 17:27:13 +05:30
components: {
GlIcon,
},
2021-01-03 14:25:43 +05:30
props: {
user: {
type: Object,
required: true,
},
imgSize: {
type: Number,
required: true,
},
},
computed: {
reviewerAlt() {
return sprintf(__("%{userName}'s avatar"), { userName: this.user.name });
},
avatarUrl() {
return this.user.avatar || this.user.avatar_url || gon.default_avatar_url;
},
hasMergeIcon() {
return !this.user.can_merge;
},
},
};
</script>
<template>
<span class="position-relative">
<img
:alt="reviewerAlt"
:src="avatarUrl"
:width="imgSize"
:class="`s${imgSize}`"
class="avatar avatar-inline m-0"
data-qa-selector="avatar_image"
/>
2021-02-22 17:27:13 +05:30
<gl-icon v-if="hasMergeIcon" name="warning-solid" aria-hidden="true" class="merge-icon" />
2021-01-03 14:25:43 +05:30
</span>
</template>