Hide join section if actor is organizer

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-07-09 15:31:18 +02:00
parent 27d294ba6d
commit a1ae4f64e4

View file

@ -57,13 +57,18 @@
<v-card-text v-if="event.description"><vue-markdown :source="event.description"></vue-markdown></v-card-text>--> <v-card-text v-if="event.description"><vue-markdown :source="event.description"></vue-markdown></v-card-text>-->
</v-flex> </v-flex>
<v-flex md2> <v-flex md2>
<p v-if="!actorIsParticipant()">Vous y allez ? <p v-if="actorIsOrganizer()">
<span class="text--darken-2 grey--text">{{ event.participants.length }} personnes y vont.</span> Vous êtes organisateur de cet événement.
</p> </p>
<p v-else> <div v-else>
Vous avez annoncé aller à cet événement. <p v-if="actorIsParticipant()">
</p> Vous avez annoncé aller à cet événement.
<v-card-actions> </p>
<p v-else>Vous y allez ?
<span class="text--darken-2 grey--text">{{ event.participants.length }} personnes y vont.</span>
</p>
</div>
<v-card-actions v-if="!actorIsOrganizer()">
<v-btn v-if="!actorIsParticipant()" @click="joinEvent" color="success"><v-icon>check</v-icon> Join</v-btn> <v-btn v-if="!actorIsParticipant()" @click="joinEvent" color="success"><v-icon>check</v-icon> Join</v-btn>
<v-btn v-if="actorIsParticipant()" @click="leaveEvent" color="error">Leave</v-btn> <v-btn v-if="actorIsParticipant()" @click="leaveEvent" color="error">Leave</v-btn>
</v-card-actions> </v-card-actions>
@ -212,8 +217,10 @@
}) })
}, },
actorIsParticipant() { actorIsParticipant() {
const actorId = this.$store.state.user.actor.id; return this.event.participants.map(participant => participant.id).includes(this.$store.state.user.actor.id) || this.actorIsOrganizer();
return this.event.participants.map(participant => participant.id).includes(actorId) || actorId === this.event.organizer.id; },
actorIsOrganizer() {
return this.$store.state.user.actor.id === this.event.organizer.id;
} }
}, },
props: { props: {