2018-09-06 18:35:02 +00:00
|
|
|
<template>
|
2021-12-06 10:35:20 +00:00
|
|
|
<router-link
|
|
|
|
:to="url"
|
|
|
|
:title="actor.full_username"
|
|
|
|
>
|
|
|
|
<template v-if="avatar">
|
|
|
|
<actor-avatar :actor="actor" /><span> </span>
|
|
|
|
</template><slot>{{ repr | truncate(truncateLength) }}</slot>
|
2019-08-29 14:14:54 +00:00
|
|
|
</router-link>
|
2018-09-06 18:35:02 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
export default {
|
2018-09-13 15:18:23 +00:00
|
|
|
props: {
|
2021-12-06 10:35:20 +00:00
|
|
|
actor: { type: Object, required: true },
|
|
|
|
avatar: { type: Boolean, default: true },
|
|
|
|
admin: { type: Boolean, default: false },
|
|
|
|
displayName: { type: Boolean, default: false },
|
|
|
|
truncateLength: { type: Number, default: 30 }
|
2020-02-05 14:06:07 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
url () {
|
2020-03-18 10:57:33 +00:00
|
|
|
if (this.admin) {
|
2021-12-06 10:35:20 +00:00
|
|
|
return { name: 'manage.moderation.accounts.detail', params: { id: this.actor.full_username } }
|
2020-03-18 10:57:33 +00:00
|
|
|
}
|
2020-02-05 14:06:07 +00:00
|
|
|
if (this.actor.is_local) {
|
2021-12-06 10:35:20 +00:00
|
|
|
return { name: 'profile.overview', params: { username: this.actor.preferred_username } }
|
2020-02-05 14:06:07 +00:00
|
|
|
} else {
|
2021-12-06 10:35:20 +00:00
|
|
|
return { name: 'profile.full.overview', params: { username: this.actor.preferred_username, domain: this.actor.domain } }
|
2020-02-05 14:06:07 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
repr () {
|
2020-03-18 10:57:33 +00:00
|
|
|
if (this.displayName || this.actor.is_local) {
|
2020-02-05 14:06:07 +00:00
|
|
|
return this.actor.preferred_username
|
|
|
|
} else {
|
|
|
|
return this.actor.full_username
|
|
|
|
}
|
|
|
|
}
|
2018-09-06 18:35:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|