feat: let one signup cover a party of spots

Capacity, mail, and the roster count each person in the group. Today's calendar shifts are a light wash on the yellow day, and the signup dialog scrolls inside its panel.
This commit is contained in:
blake committed 2026-10-28 12:08:00 -05:00
1 parent 1f451dc830
commit 63748d464a
18 files changed
+585 -68

No files matched your search

+4
View File
@@ -10,6 +10,7 @@ export type QueuedSignup = {
token: string;
volunteerName: string;
volunteerEmail: string;
groupSize?: number;
shift: MailShift;
mail: MailIdentity;
now: string;
@@ -23,6 +24,7 @@ export function queueConfirmation(db: Database.Database, input: QueuedSignup): v
shift: input.shift,
manageUrl: manageUrl(input),
replyTo: input.mail.replyTo,
groupSize: input.groupSize,
}));
}
@@ -33,6 +35,7 @@ export function queueCancellation(db: Database.Database, input: QueuedSignup): v
manageUrl: manageUrl(input),
replyTo: input.mail.replyTo,
linkNote: input.linkNote,
groupSize: input.groupSize,
}));
}
@@ -43,6 +46,7 @@ export function queueChanged(db: Database.Database, input: QueuedSignup, reason:
shift: input.shift,
manageUrl: manageUrl(input),
replyTo: input.mail.replyTo,
groupSize: input.groupSize,
};
if (reason === 'move') return renderMoved(letter);
if (reason === 'switch') return renderSwitched(letter);
+17 -5
View File
@@ -23,12 +23,13 @@ export function renderConfirmation(input: {
shift: MailShift;
manageUrl: string;
replyTo: string;
groupSize?: number;
}): RenderedMail {
const role = singleLine(input.shift.role);
const name = singleLine(input.volunteerName);
return render({
subject: `You're signed up for ${role}`,
hello: `You are signed up for ${role}.`,
hello: `You are signed up for ${role}.${partyNote(input.groupSize)}`,
greeting: `Hello ${name},`,
shift: input.shift,
linkLabel: 'Open this signup',
@@ -44,12 +45,14 @@ export function renderCancellation(input: {
manageUrl: string;
replyTo: string;
linkNote?: string;
groupSize?: number;
}): RenderedMail {
const role = singleLine(input.shift.role);
const name = singleLine(input.volunteerName);
const spots = input.groupSize && input.groupSize > 1 ? `The ${input.groupSize} spots this signup held are open for someone else.` : 'The spot is open for someone else.';
return render({
subject: `Your signup for ${role} is cancelled`,
hello: `Your signup for ${role} is cancelled. The spot is open for someone else.`,
hello: `Your signup for ${role} is cancelled. ${spots}`,
greeting: `Hello ${name},`,
shift: input.shift,
linkLabel: 'Open this signup',
@@ -64,6 +67,7 @@ export function renderChanged(input: {
shift: MailShift;
manageUrl: string;
replyTo: string;
groupSize?: number;
}): RenderedMail {
const role = singleLine(input.shift.role);
return changedLetter(input, `Your ${role} shift has changed`, `The time or place for your ${role} shift has changed.`);
@@ -74,6 +78,7 @@ export function renderMoved(input: {
shift: MailShift;
manageUrl: string;
replyTo: string;
groupSize?: number;
}): RenderedMail {
const role = singleLine(input.shift.role);
return changedLetter(input, `Your signup was moved to ${role}`, 'A coordinator moved your signup to a different shift.');
@@ -84,20 +89,21 @@ export function renderSwitched(input: {
shift: MailShift;
manageUrl: string;
replyTo: string;
groupSize?: number;
}): RenderedMail {
const role = singleLine(input.shift.role);
return changedLetter(input, `Your signup was switched to ${role}`, 'You switched this signup to a different shift.');
}
function changedLetter(
input: { volunteerName: string; shift: MailShift; manageUrl: string; replyTo: string },
input: { volunteerName: string; shift: MailShift; manageUrl: string; replyTo: string; groupSize?: number },
subject: string,
hello: string,
): RenderedMail {
const name = singleLine(input.volunteerName);
return render({
subject,
hello,
hello: `${hello}${partyNote(input.groupSize)}`,
greeting: `Hello ${name},`,
shift: input.shift,
linkLabel: 'Open this signup',
@@ -112,11 +118,12 @@ export function renderReminder(input: {
shift: MailShift;
unsubscribeUrl: string;
replyTo: string;
groupSize?: number;
}): RenderedMail {
const role = singleLine(input.shift.role);
const name = singleLine(input.volunteerName);
const subject = `Reminder: ${role}`;
const hello = `You are still signed up for ${role}.`;
const hello = `You are still signed up for ${role}.${partyNote(input.groupSize)}`;
const cancelNote = 'To cancel, use the link in your confirmation email.';
const stopNote = `To stop reminder emails for this signup, open ${input.unsubscribeUrl}. The pantry reads mail sent to ${input.replyTo}. Stopping reminders does not cancel the signup. Confirmation, change, and cancellation emails still arrive.`;
const greeting = `Hello ${name},`;
@@ -179,6 +186,11 @@ export function renderMagicLink(input: { signInUrl: string; replyTo: string }):
return { subject, text, html };
}
function partyNote(groupSize: number | undefined): string {
if (!groupSize || groupSize <= 1) return '';
return ` This signup holds ${groupSize} spots.`;
}
function render(input: {
subject: string;
greeting: string;