Fix link to direct profile on event page when external
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
8f31beb0fb
commit
f5355b1be9
21
js/src/components/Account/ActorLink.vue
Normal file
21
js/src/components/Account/ActorLink.vue
Normal file
|
@ -0,0 +1,21 @@
|
|||
<template>
|
||||
<span>
|
||||
<router-link v-if="actor.domain === null"
|
||||
:to="{name: 'Profile', params: { name: actor.preferredUsername } }"
|
||||
>
|
||||
<slot></slot>
|
||||
</router-link>
|
||||
<a v-else :href="actor.url">
|
||||
<slot></slot>
|
||||
</a>
|
||||
</span>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { IActor } from '@/types/actor';
|
||||
|
||||
@Component
|
||||
export default class ActorLink extends Vue {
|
||||
@Prop() actor!: IActor;
|
||||
}
|
||||
</script>
|
|
@ -51,6 +51,7 @@ export const FETCH_EVENT = gql`
|
|||
preferredUsername,
|
||||
domain,
|
||||
name,
|
||||
url,
|
||||
},
|
||||
# attributedTo {
|
||||
# avatar {
|
||||
|
|
|
@ -76,6 +76,7 @@ import {
|
|||
Category,
|
||||
IEvent,
|
||||
EventModel,
|
||||
EventVisibility,
|
||||
} from '@/types/event.model';
|
||||
import { LOGGED_PERSON } from '@/graphql/actor';
|
||||
import { IPerson, Person } from '@/types/actor';
|
||||
|
@ -86,7 +87,6 @@ import TagInput from '@/components/Event/TagInput.vue';
|
|||
import { TAGS } from '@/graphql/tags';
|
||||
import { ITag } from '@/types/tag.model';
|
||||
import AddressAutoComplete from '@/components/Event/AddressAutoComplete.vue';
|
||||
import { EventVisibility } from '@/types/event.model';
|
||||
|
||||
@Component({
|
||||
components: { AddressAutoComplete, TagInput, DateTimePicker, PictureUpload, Editor },
|
||||
|
|
|
@ -92,9 +92,7 @@
|
|||
</b-modal>
|
||||
</div>
|
||||
<div class="organizer">
|
||||
<router-link
|
||||
:to="{name: 'Profile', params: { name: event.organizerActor.preferredUsername } }"
|
||||
>
|
||||
<actor-link :actor="event.organizerActor">
|
||||
<translate
|
||||
:translate-params="{name: event.organizerActor.name ? event.organizerActor.name : event.organizerActor.preferredUsername}"
|
||||
v-if="event.organizerActor">By %{ name }</translate>
|
||||
|
@ -104,7 +102,7 @@
|
|||
:src="event.organizerActor.avatar.url"
|
||||
:alt="$gettextInterpolate('%{actor}\'s avatar', {actor: event.organizerActor.preferredUsername})" />
|
||||
</figure>
|
||||
</router-link>
|
||||
</actor-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -242,9 +240,11 @@ import DateCalendarIcon from '@/components/Event/DateCalendarIcon.vue';
|
|||
import BIcon from 'buefy/src/components/icon/Icon.vue';
|
||||
import EventCard from '@/components/Event/EventCard.vue';
|
||||
import EventFullDate from '@/components/Event/EventFullDate.vue';
|
||||
import ActorLink from '@/components/Account/ActorLink.vue';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
ActorLink,
|
||||
EventFullDate,
|
||||
EventCard,
|
||||
BIcon,
|
||||
|
|
Loading…
Reference in a new issue