Move Participant role from integer to enum

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-02-07 16:37:40 +01:00
parent 7b83682b26
commit 4bac5a07bd
9 changed files with 89 additions and 22 deletions

View File

@@ -21,7 +21,7 @@
<div v-else>
<span v-for="participant in event.participants" :key="participant.actor.uuid">
{{ participant.actor.preferredUsername }}
<span v-if="participant.role === 4">(organizer)</span>,
<span v-if="participant.role === ParticipantRole.CREATOR">(organizer)</span>,
<!-- <translate
:translate-params="{name: participant.actor.preferredUsername}"
>&nbsp;%{name} is in,</translate>-->
@@ -33,12 +33,18 @@
</template>
<script lang="ts">
import { IEvent } from "@/types/event.model";
import {IEvent, ParticipantRole} from "@/types/event.model";
import { Component, Prop, Vue } from "vue-property-decorator";
@Component
export default class EventCard extends Vue {
@Prop({ required: true }) event!: IEvent;
@Prop({ default: false }) hideDetails!: boolean;
data() {
return {
ParticipantRole: ParticipantRole
}
}
}
</script>

View File

@@ -20,7 +20,11 @@ export enum EventJoinOptions {
}
export enum ParticipantRole {
NOT_APPROVED = 'not_approved',
PARTICIPANT = 'participant',
MODERATOR = 'moderator',
ADMINSTRATOR = 'administrator',
CREATOR = 'creator'
}
export interface ICategory {

View File

@@ -62,7 +62,7 @@
<a v-if="!actorIsParticipant()" @click="joinEvent" class="button">
<translate>Join</translate>
</a>
<a v-if="actorIsParticipant()" @click="leaveEvent" color="button">Leave</a>
<a v-if="actorIsParticipant()" @click="leaveEvent" class="button">Leave</a>
</div>
<h2 class="subtitle">Details</h2>
<p v-if="event.description">