Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 3x 65x 65x | // The email that invites someone to a flat (Design canvas: KutsuEmail). It
// names the inviter and the invited address but not the flat: the address is
// shown after signing in, so less personal data goes to the email provider.
import { m } from '#/paraglide/messages.js'
import type { Locale } from '#/paraglide/runtime.js'
import type { EmailMessage } from '#/server/email/email'
import { renderEmail } from '#/server/email/layout'
/** How long an invitation can be accepted (spec: "Accepting a flat invitation"). */
export const INVITATION_VALID_DAYS = 30
export function invitationEmail(options: {
to: string
inviterName: string
/**
* The inviter's verified address, shown next to the name so the reader
* can tell who sent it: anyone can choose any name.
*/
inviterEmail: string
/** Where "Open Kotivalo" leads: the app's origin. */
appUrl: string
locale: Locale
/** Makes a retried send safe. */
invitationId: string
}): EmailMessage {
const { to, inviterName: inviter, appUrl, locale } = options
return renderEmail({
to,
locale,
appUrl,
// No name in the subject: it is the line a phishing attempt would use.
subject: m.invitation_email_subject({}, { locale }),
heading: m.invitation_email_heading({}, { locale }),
paragraphs: [
m.invitation_email_intro(
{ inviter, inviterEmail: options.inviterEmail },
{ locale },
),
m.invitation_email_sign_in({ email: to }, { locale }),
m.invitation_email_validity({ days: INVITATION_VALID_DAYS }, { locale }),
m.invitation_email_ignore({}, { locale }),
],
action: { label: m.invitation_email_action({}, { locale }), url: appUrl },
idempotencyKey: `invitation-${options.invitationId}`,
})
}
|