Add tests for participation without account
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -81,33 +81,72 @@
|
||||
{{ $t("Request for participation confirmation sent") }}
|
||||
</h1>
|
||||
<p class="content">
|
||||
{{ $t("Check your inbox (and your junk mail folder).") }}
|
||||
<span>{{
|
||||
$t("Check your inbox (and your junk mail folder).")
|
||||
}}</span>
|
||||
<span
|
||||
class="details"
|
||||
v-if="event.joinOptions === EventJoinOptions.RESTRICTED"
|
||||
>
|
||||
{{
|
||||
$t(
|
||||
"Your participation will be validated once you click the confirmation link into the email, and after the organizer manually validates your participation."
|
||||
)
|
||||
}} </span
|
||||
><span class="details" v-else>{{
|
||||
$t(
|
||||
"Your participation will be validated once you click the confirmation link into the email."
|
||||
)
|
||||
}}</span>
|
||||
</p>
|
||||
<b-message type="is-warning" v-if="error">{{ error }}</b-message>
|
||||
<p class="content">
|
||||
<i18n path="You may now close this window, or {return_to_event}.">
|
||||
<router-link
|
||||
slot="return_to_event"
|
||||
:to="{ name: RouteName.EVENT, params: { uuid: event.uuid } }"
|
||||
>{{ $t("return to the event's page") }}</router-link
|
||||
>
|
||||
</i18n>
|
||||
</p>
|
||||
<p class="content">{{ $t("You may now close this window.") }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<b-message type="is-danger" v-else-if="!$apollo.loading"
|
||||
>{{
|
||||
$t(
|
||||
"Unable to load event for participation. The error details are provided below:"
|
||||
)
|
||||
}}
|
||||
<details>
|
||||
<pre>{{ error }}</pre>
|
||||
</details>
|
||||
</b-message>
|
||||
</section>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { EventModel, IEvent } from "@/types/event.model";
|
||||
import { FETCH_EVENT, JOIN_EVENT } from "@/graphql/event";
|
||||
import { FETCH_EVENT_BASIC, JOIN_EVENT } from "@/graphql/event";
|
||||
import { IConfig } from "@/types/config.model";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import { addLocalUnconfirmedAnonymousParticipation } from "@/services/AnonymousParticipationStorage";
|
||||
import { EventJoinOptions, ParticipantRole } from "@/types/enums";
|
||||
import RouteName from "@/router/name";
|
||||
import { IParticipant } from "../../types/participant.model";
|
||||
|
||||
@Component({
|
||||
apollo: {
|
||||
event: {
|
||||
query: FETCH_EVENT,
|
||||
query: FETCH_EVENT_BASIC,
|
||||
variables() {
|
||||
return {
|
||||
uuid: this.uuid,
|
||||
};
|
||||
},
|
||||
error(e) {
|
||||
this.error = e;
|
||||
},
|
||||
skip() {
|
||||
return !this.uuid;
|
||||
},
|
||||
@@ -141,6 +180,8 @@ export default class ParticipationWithoutAccount extends Vue {
|
||||
|
||||
EventJoinOptions = EventJoinOptions;
|
||||
|
||||
RouteName = RouteName;
|
||||
|
||||
async joinEvent(): Promise<void> {
|
||||
this.error = false;
|
||||
this.sendingForm = true;
|
||||
@@ -163,7 +204,7 @@ export default class ParticipationWithoutAccount extends Vue {
|
||||
}
|
||||
|
||||
const cachedData = store.readQuery<{ event: IEvent }>({
|
||||
query: FETCH_EVENT,
|
||||
query: FETCH_EVENT_BASIC,
|
||||
variables: { uuid: this.event.uuid },
|
||||
});
|
||||
if (cachedData == null) {
|
||||
@@ -186,16 +227,15 @@ export default class ParticipationWithoutAccount extends Vue {
|
||||
event.participantStats.going += 1;
|
||||
event.participantStats.participant += 1;
|
||||
}
|
||||
console.log("just before writequery");
|
||||
|
||||
store.writeQuery({
|
||||
query: FETCH_EVENT,
|
||||
query: FETCH_EVENT_BASIC,
|
||||
variables: { uuid: this.event.uuid },
|
||||
data: { event },
|
||||
});
|
||||
},
|
||||
});
|
||||
console.log("finished with store", data);
|
||||
this.formSent = true;
|
||||
if (
|
||||
data &&
|
||||
data.joinEvent.metadata.cancellationToken &&
|
||||
@@ -205,13 +245,28 @@ export default class ParticipationWithoutAccount extends Vue {
|
||||
this.event,
|
||||
data.joinEvent.metadata.cancellationToken
|
||||
);
|
||||
console.log("done with crypto stuff");
|
||||
}
|
||||
} catch (e) {
|
||||
this.error = e.message;
|
||||
if (
|
||||
["TextEncoder is not defined", "crypto.subtle is undefined"].includes(
|
||||
e.message
|
||||
)
|
||||
) {
|
||||
this.error = this.$t(
|
||||
"Unable to save your participation in this browser."
|
||||
) as string;
|
||||
} else if (e.graphQLErrors && e.graphQLErrors.length > 0) {
|
||||
this.error = e.graphQLErrors[0].message;
|
||||
} else if (e.networkError) {
|
||||
this.error = e.networkError.message;
|
||||
}
|
||||
}
|
||||
this.sendingForm = false;
|
||||
this.formSent = true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
section.container.section {
|
||||
background: $white;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -176,6 +176,22 @@ export const FETCH_EVENT = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const FETCH_EVENT_BASIC = gql`
|
||||
query($uuid: UUID!) {
|
||||
event(uuid: $uuid) {
|
||||
id
|
||||
uuid
|
||||
joinOptions
|
||||
participantStats {
|
||||
going
|
||||
notApproved
|
||||
notConfirmed
|
||||
participant
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const FETCH_EVENTS = gql`
|
||||
query {
|
||||
events {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
"Anonymous participant": "Anonymous participant",
|
||||
"Anonymous participants will be asked to confirm their participation through e-mail.": "Anonymous participants will be asked to confirm their participation through e-mail.",
|
||||
"Anonymous participations": "Anonymous participations",
|
||||
"Approve": "Approve",
|
||||
"Are you really sure you want to delete your whole account? You'll lose everything. Identities, settings, events created, messages and participations will be gone forever.": "Are you really sure you want to delete your whole account? You'll lose everything. Identities, settings, events created, messages and participations will be gone forever.",
|
||||
"Are you sure you want to <b>delete</b> this comment? This action cannot be undone.": "Are you sure you want to <b>delete</b> this comment? This action cannot be undone.",
|
||||
"Are you sure you want to <b>delete</b> this event? This action cannot be undone. You may want to engage the discussion with the event creator or edit its event instead.": "Are you sure you want to <b>delete</b> this event? This action cannot be undone. You may want to engage the discussion with the event creator or edit its event instead.",
|
||||
@@ -70,7 +69,6 @@
|
||||
"Create my profile": "Create my profile",
|
||||
"Create token": "Create token",
|
||||
"Create": "Create",
|
||||
"Creator": "Creator",
|
||||
"Current identity has been changed to {identityName} in order to manage this event.": "Current identity has been changed to {identityName} in order to manage this event.",
|
||||
"Current page": "Current page",
|
||||
"Custom URL": "Custom URL",
|
||||
@@ -126,7 +124,6 @@
|
||||
"Event": "Event",
|
||||
"Events": "Events",
|
||||
"Ex: mobilizon.fr": "Ex: mobilizon.fr",
|
||||
"Exclude": "Exclude",
|
||||
"Explore": "Explore",
|
||||
"Failed to save admin settings": "Failed to save admin settings",
|
||||
"Featured events": "Featured events",
|
||||
@@ -145,7 +142,6 @@
|
||||
"General": "General",
|
||||
"Getting location": "Getting location",
|
||||
"Go": "Go",
|
||||
"Going as {name}": "Going as {name}",
|
||||
"Group name": "Group name",
|
||||
"Group {displayName} created": "Group {displayName} created",
|
||||
"Groups": "Groups",
|
||||
@@ -280,7 +276,6 @@
|
||||
"Registration is allowed, anyone can register.": "Registration is allowed, anyone can register.",
|
||||
"Registration is closed.": "Registration is closed.",
|
||||
"Registration is currently closed.": "Registration is currently closed.",
|
||||
"Reject": "Reject",
|
||||
"Rejected": "Rejected",
|
||||
"Reopen": "Reopen",
|
||||
"Reply": "Reply",
|
||||
@@ -749,7 +744,7 @@
|
||||
"Go to the event page": "Go to the event page",
|
||||
"Request for participation confirmation sent": "Request for participation confirmation sent",
|
||||
"Check your inbox (and your junk mail folder).": "Check your inbox (and your junk mail folder).",
|
||||
"You may now close this window.": "You may now close this window.",
|
||||
"You may now close this window, or {return_to_event}.": "You may now close this window, or {return_to_event}.",
|
||||
"Create an account": "Create an account",
|
||||
"You are not an administrator for this group.": "You are not an administrator for this group.",
|
||||
"Why create an account?": "Why create an account?",
|
||||
@@ -810,5 +805,10 @@
|
||||
"Your participation status is saved only on this device and will be deleted one month after the event's passed.": "Your participation status is saved only on this device and will be deleted one month after the event's passed.",
|
||||
"You may clear all participation information for this device with the buttons below.": "You may clear all participation information for this device with the buttons below.",
|
||||
"Clear participation data for this event": "Clear participation data for this event",
|
||||
"Clear participation data for all events": "Clear participation data for all events"
|
||||
"Clear participation data for all events": "Clear participation data for all events",
|
||||
"Your participation will be validated once you click the confirmation link into the email, and after the organizer manually validates your participation.": "Your participation will be validated once you click the confirmation link into the email, and after the organizer manually validates your participation.",
|
||||
"Your participation will be validated once you click the confirmation link into the email.": "Your participation will be validated once you click the confirmation link into the email.",
|
||||
"Unable to load event for participation. The error details are provided below:": "Unable to load event for participation. The error details are provided below:",
|
||||
"Unable to save your participation in this browser.": "Unable to save your participation in this browser.",
|
||||
"return to the event's page": "return to the event's page"
|
||||
}
|
||||
|
||||
@@ -794,7 +794,6 @@
|
||||
"You have one event today.": "Vous n'avez pas d'évenement aujourd'hui | Vous avez un évènement aujourd'hui. | Vous avez {count} évènements aujourd'hui",
|
||||
"You have one event tomorrow.": "Vous n'avez pas d'évènement demain | Vous avez un évènement demain. | Vous avez {count} évènements demain",
|
||||
"You may also ask to {resend_confirmation_email}.": "Vous pouvez aussi demander à {resend_confirmation_email}.",
|
||||
"You may now close this window.": "Vous pouvez maintenant fermer cette fenêtre.",
|
||||
"You need to create the group before you create an event.": "Vous devez créer le groupe avant de créer l'événement.",
|
||||
"You need to login.": "Vous devez vous connecter.",
|
||||
"You will be able to add an avatar and set other options in your account settings.": "Vous pourrez ajouter un avatar et définir d'autres options dans les paramètres de votre compte.",
|
||||
@@ -898,5 +897,11 @@
|
||||
"Your participation status is saved only on this device and will be deleted one month after the event's passed.": "Le statut de votre participation est enregistré uniquement sur cet appareil et sera supprimé un mois après la fin de l'événement.",
|
||||
"You may clear all participation information for this device with the buttons below.": "Vous pouvez effacer toutes les informations de participation pour cet appareil avec les boutons ci-dessous.",
|
||||
"Clear participation data for this event": "Effacer mes données de participation pour cet événement",
|
||||
"Clear participation data for all events": "Effacer mes données de participation pour tous les événements"
|
||||
"Clear participation data for all events": "Effacer mes données de participation pour tous les événements",
|
||||
"Your participation will be validated once you click the confirmation link into the email, and after the organizer manually validates your participation.": "Votre participation sera validée une fois que vous aurez cliqué sur le lien de confirmation contenu dans le courriel, et après que l'organisateur·ice valide votre participation.",
|
||||
"Your participation will be validated once you click the confirmation link into the email.": "Votre participation sera validée une fois que vous aurez cliqué sur le lien de confirmation contenu dans le courriel.",
|
||||
"Unable to load event for participation. The error details are provided below:": "Impossible de charger l'événement pour la participation. Les détails de l'erreur sont disponibles ci-dessous :",
|
||||
"Unable to save your participation in this browser.": "Échec de la sauvegarde de votre participation dans ce navigateur.",
|
||||
"return to the event's page": "retourner sur la page de l'événement",
|
||||
"You may now close this window, or {return_to_event}.": "Vous pouvez maintenant fermer cette fenêtre, ou bien {return_to_event}."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user