fix: FIFO queue for waitlisting; send email for application form; EU logo in contact page in light mode
This commit is contained in:
@@ -128,8 +128,6 @@ export async function action({ params, request }: Route.ActionArgs) {
|
||||
const { event } = requireEntity(await fetchEvent(slug, locale));
|
||||
const form = await request.formData();
|
||||
|
||||
const waitlist = isWaitlisted(event);
|
||||
|
||||
/* A form nobody can submit through the page must not be submittable through
|
||||
a POST either - registration state is checked again on the server. */
|
||||
if (!isRegistrationOpen(event)) {
|
||||
@@ -138,7 +136,7 @@ export async function action({ params, request }: Route.ActionArgs) {
|
||||
|
||||
/* A bot that fills every field gets the acknowledgement and writes nothing. */
|
||||
if (isHoneypotFilled(form)) {
|
||||
return { ok: true, waitlist } satisfies ActionResult;
|
||||
return { ok: true, waitlist: isWaitlisted(event) } satisfies ActionResult;
|
||||
}
|
||||
|
||||
const { values, errors, valid } = validateRegistration(form);
|
||||
@@ -150,6 +148,7 @@ export async function action({ params, request }: Route.ActionArgs) {
|
||||
);
|
||||
}
|
||||
|
||||
let registrationState: "confirmed" | "waitlisted";
|
||||
try {
|
||||
/* Only the fields the CMS whitelist accepts are sent - see
|
||||
./_events-opportunities/submissions.server.ts. `registrationState` is
|
||||
@@ -159,7 +158,11 @@ export async function action({ params, request }: Route.ActionArgs) {
|
||||
`waitlist` flag below is therefore presentational - it decides which
|
||||
sentence the reader sees, and it is read from the same event fields the
|
||||
middleware weighs, so the two agree. */
|
||||
await submitRegistration({ values, eventId: event.documentId });
|
||||
registrationState = await submitRegistration({
|
||||
values,
|
||||
eventId: event.documentId,
|
||||
forwardedFor: request.headers.get("x-forwarded-for") ?? undefined,
|
||||
});
|
||||
} catch (error) {
|
||||
if (!isStrapiError(error)) throw error;
|
||||
/* A 4xx here is the CMS refusing the registration on its own terms - the
|
||||
@@ -175,7 +178,10 @@ export async function action({ params, request }: Route.ActionArgs) {
|
||||
);
|
||||
}
|
||||
|
||||
return { ok: true, waitlist } satisfies ActionResult;
|
||||
return {
|
||||
ok: true,
|
||||
waitlist: registrationState === "waitlisted",
|
||||
} satisfies ActionResult;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user