Refactor Core things, including Ecto handling, ActivityPub & Transmogrifier modules
* Data doesn't need anymore to be converted to ActivityStream format to be saved (this was taken from Pleroma and not at all a good idea here) * Everything saved when creating an event is inserted into PostgreSQL in a single transaction
This commit is contained in:
@@ -14,7 +14,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
participation: {
|
||||
event: {
|
||||
event: {
|
||||
title: 'Vue Styleguidist first meetup: learn the basics!',
|
||||
id: 5,
|
||||
uuid: 'some uuid',
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
},
|
||||
participantStats: {
|
||||
approved: 1,
|
||||
unapproved: 2
|
||||
notApproved: 2
|
||||
}
|
||||
},
|
||||
actor: {
|
||||
@@ -75,20 +75,20 @@ export default {
|
||||
</span>
|
||||
<span class="column is-narrow participant-stats">
|
||||
<span v-if="participation.event.options.maximumAttendeeCapacity !== 0">
|
||||
{{ $t('{approved} / {total} seats', {approved: participation.event.participantStats.participants, total: participation.event.options.maximumAttendeeCapacity }) }}
|
||||
{{ $t('{approved} / {total} seats', {approved: participation.event.participantStats.participant, total: participation.event.options.maximumAttendeeCapacity }) }}
|
||||
<!-- <b-progress-->
|
||||
<!-- v-if="participation.event.options.maximumAttendeeCapacity > 0"-->
|
||||
<!-- size="is-medium"-->
|
||||
<!-- :value="participation.event.participantStats.participants * 100 / participation.event.options.maximumAttendeeCapacity">-->
|
||||
<!-- :value="participation.event.participantStats.participant * 100 / participation.event.options.maximumAttendeeCapacity">-->
|
||||
<!-- </b-progress>-->
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ $tc('{count} participants', participation.event.participantStats.participants, { count: participation.event.participantStats.participants })}}
|
||||
{{ $tc('{count} participants', participation.event.participantStats.participant, { count: participation.event.participantStats.participant })}}
|
||||
</span>
|
||||
<span
|
||||
v-if="participation.event.participantStats.unapproved > 0">
|
||||
v-if="participation.event.participantStats.notApproved > 0">
|
||||
<b-button type="is-text" @click="gotToWithCheck(participation, { name: RouteName.PARTICIPATIONS, params: { eventId: participation.event.uuid } })">
|
||||
{{ $tc('{count} requests waiting', participation.event.participantStats.unapproved, { count: participation.event.participantStats.unapproved })}}
|
||||
{{ $tc('{count} requests waiting', participation.event.participantStats.notApproved, { count: participation.event.participantStats.notApproved })}}
|
||||
</b-button>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -113,9 +113,8 @@ query LoggedUserParticipations($afterDateTime: DateTime, $beforeDateTime: DateTi
|
||||
}
|
||||
},
|
||||
participantStats {
|
||||
approved,
|
||||
unapproved,
|
||||
participants
|
||||
notApproved
|
||||
participant
|
||||
},
|
||||
options {
|
||||
maximumAttendeeCapacity
|
||||
@@ -161,8 +160,8 @@ export const LOGGED_USER_DRAFTS = gql`
|
||||
}
|
||||
},
|
||||
participantStats {
|
||||
approved,
|
||||
unapproved
|
||||
going,
|
||||
notApproved
|
||||
},
|
||||
options {
|
||||
maximumAttendeeCapacity
|
||||
|
||||
@@ -102,9 +102,9 @@ export const FETCH_EVENT = gql`
|
||||
# name,
|
||||
# },
|
||||
participantStats {
|
||||
approved,
|
||||
unapproved,
|
||||
participants
|
||||
going,
|
||||
notApproved,
|
||||
participant
|
||||
},
|
||||
tags {
|
||||
${tagsQuery}
|
||||
@@ -259,9 +259,9 @@ export const CREATE_EVENT = gql`
|
||||
id,
|
||||
},
|
||||
participantStats {
|
||||
approved,
|
||||
unapproved,
|
||||
participants
|
||||
going,
|
||||
notApproved,
|
||||
participant
|
||||
},
|
||||
tags {
|
||||
${tagsQuery}
|
||||
@@ -344,9 +344,9 @@ export const EDIT_EVENT = gql`
|
||||
id,
|
||||
},
|
||||
participantStats {
|
||||
approved,
|
||||
unapproved,
|
||||
participants
|
||||
going,
|
||||
notApproved,
|
||||
participant
|
||||
},
|
||||
tags {
|
||||
${tagsQuery}
|
||||
@@ -410,10 +410,10 @@ export const PARTICIPANTS = gql`
|
||||
${participantQuery}
|
||||
},
|
||||
participantStats {
|
||||
approved,
|
||||
unapproved,
|
||||
going,
|
||||
notApproved,
|
||||
rejected,
|
||||
participants
|
||||
participant
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ import { IPerson } from '@/types/actor';
|
||||
@Component
|
||||
export default class EventMixin extends mixins(Vue) {
|
||||
async openDeleteEventModal (event: IEvent, currentActor: IPerson) {
|
||||
const participantsLength = event.participantStats.approved;
|
||||
const participantsLength = event.participantStats.participant;
|
||||
const prefix = participantsLength
|
||||
? this.$tc('There are {participants} participants.', event.participantStats.approved, {
|
||||
participants: event.participantStats.approved,
|
||||
? this.$tc('There are {participants} participants.', event.participantStats.participant, {
|
||||
participants: event.participantStats.participant,
|
||||
})
|
||||
: '';
|
||||
|
||||
|
||||
@@ -94,10 +94,13 @@ export enum CommentModeration {
|
||||
}
|
||||
|
||||
export interface IEventParticipantStats {
|
||||
approved: number;
|
||||
unapproved: number;
|
||||
notApproved: number;
|
||||
rejected: number;
|
||||
participants: number;
|
||||
participant: number;
|
||||
creator: number;
|
||||
moderator: number;
|
||||
administrator: number;
|
||||
going: number;
|
||||
}
|
||||
|
||||
export interface IEvent {
|
||||
@@ -192,7 +195,7 @@ export class EventModel implements IEvent {
|
||||
|
||||
publishAt = new Date();
|
||||
|
||||
participantStats = { approved: 0, unapproved: 0, rejected: 0, participants: 0 };
|
||||
participantStats = { notApproved: 0, rejected: 0, participant: 0, moderator: 0, administrator: 0, creator: 0, going: 0 };
|
||||
participants: IParticipant[] = [];
|
||||
|
||||
relatedEvents: IEvent[] = [];
|
||||
|
||||
@@ -16,18 +16,18 @@ import {ParticipantRole} from "@/types/event.model";
|
||||
<h1 class="title">{{ event.title }}</h1>
|
||||
<span>
|
||||
<router-link v-if="actorIsOrganizer" :to="{ name: RouteName.PARTICIPATIONS, params: {eventId: event.uuid}}">
|
||||
<small v-if="event.participantStats.approved > 0 && !actorIsParticipant">
|
||||
{{ $tc('One person is going', event.participantStats.approved, {approved: event.participantStats.approved}) }}
|
||||
<small v-if="event.participantStats.going > 0 && !actorIsParticipant">
|
||||
{{ $tc('One person is going', event.participantStats.going, {approved: event.participantStats.going}) }}
|
||||
</small>
|
||||
<small v-else-if="event.participantStats.approved > 0 && actorIsParticipant">
|
||||
{{ $tc('You and one other person are going to this event', event.participantStats.participants, { approved: event.participantStats.participants }) }}
|
||||
<small v-else-if="event.participantStats.going > 0 && actorIsParticipant">
|
||||
{{ $tc('You and one other person are going to this event', event.participantStats.participant, { approved: event.participantStats.participant }) }}
|
||||
</small>
|
||||
</router-link>
|
||||
<small v-if="event.participantStats.approved > 0 && !actorIsParticipant && !actorIsOrganizer">
|
||||
{{ $tc('One person is going', event.participantStats.approved, {approved: event.participantStats.approved}) }}
|
||||
<small v-if="event.participantStats.going > 0 && !actorIsParticipant && !actorIsOrganizer">
|
||||
{{ $tc('One person is going', event.participantStats.going, {approved: event.participantStats.going}) }}
|
||||
</small>
|
||||
<small v-else-if="event.participantStats.approved > 0 && actorIsParticipant && !actorIsOrganizer">
|
||||
{{ $tc('You and one other person are going to this event', event.participantStats.participants, { approved: event.participantStats.participants }) }}
|
||||
<small v-else-if="event.participantStats.going > 0 && actorIsParticipant && !actorIsOrganizer">
|
||||
{{ $tc('You and one other person are going to this event', event.participantStats.participant, { approved: event.participantStats.participant }) }}
|
||||
</small>
|
||||
<small v-if="event.options.maximumAttendeeCapacity">
|
||||
{{ $tc('All the places have already been taken', numberOfPlacesStillAvailable, { places: numberOfPlacesStillAvailable}) }}
|
||||
@@ -443,10 +443,10 @@ export default class Event extends EventMixin {
|
||||
}
|
||||
|
||||
if (data.joinEvent.role === ParticipantRole.NOT_APPROVED) {
|
||||
event.participantStats.unapproved = event.participantStats.unapproved + 1;
|
||||
event.participantStats.notApproved = event.participantStats.notApproved + 1;
|
||||
} else {
|
||||
event.participantStats.approved = event.participantStats.approved + 1;
|
||||
event.participantStats.participants = event.participantStats.participants + 1;
|
||||
event.participantStats.going = event.participantStats.going + 1;
|
||||
event.participantStats.participant = event.participantStats.participant + 1;
|
||||
}
|
||||
|
||||
store.writeQuery({ query: FETCH_EVENT, variables: { uuid: this.uuid }, data: { event } });
|
||||
@@ -514,10 +514,10 @@ export default class Event extends EventMixin {
|
||||
return;
|
||||
}
|
||||
if (participation.role === ParticipantRole.NOT_APPROVED) {
|
||||
event.participantStats.unapproved = event.participantStats.unapproved - 1;
|
||||
event.participantStats.notApproved = event.participantStats.notApproved - 1;
|
||||
} else {
|
||||
event.participantStats.approved = event.participantStats.approved - 1;
|
||||
event.participantStats.participants = event.participantStats.participants - 1;
|
||||
event.participantStats.going = event.participantStats.going - 1;
|
||||
event.participantStats.participant = event.participantStats.participant - 1;
|
||||
}
|
||||
store.writeQuery({ query: FETCH_EVENT, variables: { uuid: this.uuid }, data: { event } });
|
||||
},
|
||||
@@ -591,11 +591,11 @@ export default class Event extends EventMixin {
|
||||
|
||||
get eventCapacityOK(): boolean {
|
||||
if (!this.event.options.maximumAttendeeCapacity) return true;
|
||||
return this.event.options.maximumAttendeeCapacity > this.event.participantStats.participants;
|
||||
return this.event.options.maximumAttendeeCapacity > this.event.participantStats.participant;
|
||||
}
|
||||
|
||||
get numberOfPlacesStillAvailable(): number {
|
||||
return this.event.options.maximumAttendeeCapacity - this.event.participantStats.participants;
|
||||
return this.event.options.maximumAttendeeCapacity - this.event.participantStats.participant;
|
||||
}
|
||||
|
||||
urlToHostname(url: string): string|null {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<b-tab-item>
|
||||
<template slot="header">
|
||||
<b-icon icon="account-multiple"></b-icon>
|
||||
<span>{{ $t('Participants')}} <b-tag rounded> {{ participantStats.approved }} </b-tag> </span>
|
||||
<span>{{ $t('Participants')}} <b-tag rounded> {{ participantStats.going }} </b-tag> </span>
|
||||
</template>
|
||||
<template>
|
||||
<section v-if="participantsAndCreators.length > 0">
|
||||
@@ -22,10 +22,10 @@
|
||||
</section>
|
||||
</template>
|
||||
</b-tab-item>
|
||||
<b-tab-item :disabled="participantStats.unapproved === 0">
|
||||
<b-tab-item :disabled="participantStats.notApproved === 0">
|
||||
<template slot="header">
|
||||
<b-icon icon="account-multiple-plus"></b-icon>
|
||||
<span>{{ $t('Requests') }} <b-tag rounded> {{ participantStats.unapproved }} </b-tag> </span>
|
||||
<span>{{ $t('Requests') }} <b-tag rounded> {{ participantStats.notApproved }} </b-tag> </span>
|
||||
</template>
|
||||
<template>
|
||||
<section v-if="queue.length > 0">
|
||||
@@ -182,7 +182,7 @@ export default class Participants extends Vue {
|
||||
@Watch('participantStats', { deep: true })
|
||||
watchParticipantStats(stats: IEventParticipantStats) {
|
||||
if (!stats) return;
|
||||
if ((stats.unapproved === 0 && this.activeTab === 1) || stats.rejected === 0 && this.activeTab === 2 ) {
|
||||
if ((stats.notApproved === 0 && this.activeTab === 1) || stats.rejected === 0 && this.activeTab === 2 ) {
|
||||
this.activeTab = 0;
|
||||
}
|
||||
}
|
||||
@@ -223,9 +223,9 @@ export default class Participants extends Vue {
|
||||
if (data) {
|
||||
this.queue = this.queue.filter(participant => participant.id !== data.updateParticipation.id);
|
||||
this.rejected = this.rejected.filter(participant => participant.id !== data.updateParticipation.id);
|
||||
this.event.participantStats.approved += 1;
|
||||
this.event.participantStats.going += 1;
|
||||
if (participant.role === ParticipantRole.NOT_APPROVED) {
|
||||
this.event.participantStats.unapproved -= 1;
|
||||
this.event.participantStats.notApproved -= 1;
|
||||
}
|
||||
if (participant.role === ParticipantRole.REJECTED) {
|
||||
this.event.participantStats.rejected -= 1;
|
||||
@@ -253,11 +253,11 @@ export default class Participants extends Vue {
|
||||
this.queue = this.queue.filter(participant => participant.id !== data.updateParticipation.id);
|
||||
this.event.participantStats.rejected += 1;
|
||||
if (participant.role === ParticipantRole.PARTICIPANT) {
|
||||
this.event.participantStats.participants -= 1;
|
||||
this.event.participantStats.approved -= 1;
|
||||
this.event.participantStats.participant -= 1;
|
||||
this.event.participantStats.going -= 1;
|
||||
}
|
||||
if (participant.role === ParticipantRole.NOT_APPROVED) {
|
||||
this.event.participantStats.unapproved -= 1;
|
||||
this.event.participantStats.notApproved -= 1;
|
||||
}
|
||||
participant.role = ParticipantRole.REJECTED;
|
||||
this.rejected = this.rejected.filter(participantIn => participantIn.id !== participant.id);
|
||||
|
||||
Reference in New Issue
Block a user