- Q-1 one entry per host (iapl:mail-relay:site:<host>); a read never deletes or writes; another host's
entry is neither used nor touched (a developer's process on the live database, www and apex, a copy)
- a database that holds another host's connection and none of this site's does not enrol by itself:
"Connect again" does, once; mail.relay.otherHosts ('wait' | 'enrol' | the site's own other hosts);
panel text and doctor finding; a site with an empty store enrols by itself as before
- Q-2 the file limit answers from what is stored and never asks the service
- Q-3 a file whose mail was not confirmed is not reported as a wrong file, and no notice mail follows
- Q-4 its own text when the access-key field is off
- D-1 docs for open enrolment; staging, copies and several hosts
Co-Authored-By: Claude Fable 5.2 <[email protected]>
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import type { BasePayload } from 'payload'
|
|
|
|
import type { NotificationsData, NotificationTexts } from './types.js'
|
|
|
|
import { resolveLightboxTexts } from '../lightbox/texts.js'
|
|
import { getGlobal } from '../payload/index.js'
|
|
import { notificationFallback } from './defaults.js'
|
|
|
|
type GetNotificationTextsArgs = {
|
|
/** Active locale — selects the language variant of each text. */
|
|
locale?: string
|
|
payload: BasePayload
|
|
}
|
|
|
|
/**
|
|
* Resolves notification texts from the Notifications global, falling back per
|
|
* field to the defaults in the page's language (Polish for 'pl', else English).
|
|
* Mirrors getConsentTexts: one read, per-field fallback, locale-aware. The frontend maps a submitForm result code to the
|
|
* matching text and styles it however it likes (toast, inline, banner).
|
|
*/
|
|
export async function getNotificationTexts({
|
|
locale,
|
|
payload,
|
|
}: GetNotificationTextsArgs): Promise<NotificationTexts> {
|
|
const g = await getGlobal<NotificationsData>(payload, 'notifications', { locale })
|
|
|
|
const f = g.form ?? {}
|
|
const fb = notificationFallback(locale).form
|
|
|
|
return {
|
|
form: {
|
|
back: f.back || fb.back,
|
|
consent: f.consent || fb.consent,
|
|
error: f.error || fb.error,
|
|
fileCount: f.fileCount || fb.fileCount,
|
|
fileNotConfirmed: fb.fileNotConfirmed,
|
|
fileNotSent: f.fileNotSent || fb.fileNotSent,
|
|
fileOptional: f.fileOptional || fb.fileOptional,
|
|
fileRefused: f.fileRefused || fb.fileRefused,
|
|
fileRemove: f.fileRemove || fb.fileRemove,
|
|
fileTooLarge: f.fileTooLarge || fb.fileTooLarge,
|
|
fileType: f.fileType || fb.fileType,
|
|
next: f.next || fb.next,
|
|
notFound: f.notFound || fb.notFound,
|
|
rateLimited: f.rateLimited || fb.rateLimited,
|
|
stepOf: f.stepOf || fb.stepOf,
|
|
success: f.success || fb.success,
|
|
turnstile: f.turnstile || fb.turnstile,
|
|
validation: f.validation || fb.validation,
|
|
},
|
|
lightbox: resolveLightboxTexts(g.lightbox, locale),
|
|
}
|
|
}
|