Fix link to direct profile on event page when external

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-08-09 11:32:14 +02:00
parent 8f31beb0fb
commit f5355b1be9
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
4 changed files with 30 additions and 8 deletions

View 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>

View file

@ -51,6 +51,7 @@ export const FETCH_EVENT = gql`
preferredUsername, preferredUsername,
domain, domain,
name, name,
url,
}, },
# attributedTo { # attributedTo {
# avatar { # avatar {

View file

@ -76,6 +76,7 @@ import {
Category, Category,
IEvent, IEvent,
EventModel, EventModel,
EventVisibility,
} from '@/types/event.model'; } from '@/types/event.model';
import { LOGGED_PERSON } from '@/graphql/actor'; import { LOGGED_PERSON } from '@/graphql/actor';
import { IPerson, Person } from '@/types/actor'; import { IPerson, Person } from '@/types/actor';
@ -86,7 +87,6 @@ import TagInput from '@/components/Event/TagInput.vue';
import { TAGS } from '@/graphql/tags'; import { TAGS } from '@/graphql/tags';
import { ITag } from '@/types/tag.model'; import { ITag } from '@/types/tag.model';
import AddressAutoComplete from '@/components/Event/AddressAutoComplete.vue'; import AddressAutoComplete from '@/components/Event/AddressAutoComplete.vue';
import { EventVisibility } from '@/types/event.model';
@Component({ @Component({
components: { AddressAutoComplete, TagInput, DateTimePicker, PictureUpload, Editor }, components: { AddressAutoComplete, TagInput, DateTimePicker, PictureUpload, Editor },

View file

@ -92,19 +92,17 @@
</b-modal> </b-modal>
</div> </div>
<div class="organizer"> <div class="organizer">
<router-link <actor-link :actor="event.organizerActor">
:to="{name: 'Profile', params: { name: event.organizerActor.preferredUsername } }" <translate
> :translate-params="{name: event.organizerActor.name ? event.organizerActor.name : event.organizerActor.preferredUsername}"
<translate v-if="event.organizerActor">By %{ name }</translate>
:translate-params="{name: event.organizerActor.name ? event.organizerActor.name : event.organizerActor.preferredUsername}"
v-if="event.organizerActor">By %{ name }</translate>
<figure v-if="event.organizerActor.avatar" class="image is-48x48"> <figure v-if="event.organizerActor.avatar" class="image is-48x48">
<img <img
class="is-rounded" class="is-rounded"
:src="event.organizerActor.avatar.url" :src="event.organizerActor.avatar.url"
:alt="$gettextInterpolate('%{actor}\'s avatar', {actor: event.organizerActor.preferredUsername})" /> :alt="$gettextInterpolate('%{actor}\'s avatar', {actor: event.organizerActor.preferredUsername})" />
</figure> </figure>
</router-link> </actor-link>
</div> </div>
</div> </div>
</div> </div>
@ -242,9 +240,11 @@ import DateCalendarIcon from '@/components/Event/DateCalendarIcon.vue';
import BIcon from 'buefy/src/components/icon/Icon.vue'; import BIcon from 'buefy/src/components/icon/Icon.vue';
import EventCard from '@/components/Event/EventCard.vue'; import EventCard from '@/components/Event/EventCard.vue';
import EventFullDate from '@/components/Event/EventFullDate.vue'; import EventFullDate from '@/components/Event/EventFullDate.vue';
import ActorLink from '@/components/Account/ActorLink.vue';
@Component({ @Component({
components: { components: {
ActorLink,
EventFullDate, EventFullDate,
EventCard, EventCard,
BIcon, BIcon,