MCPcopy Index your code
hub / github.com/ether/etherpad / decideEmails

Function decideEmails

src/node/updater/Notifier.ts:43–64  ·  view source on GitHub ↗
(input: NotifierInput)

Source from the content-addressed store, hash-verified

41 * Cadence: severe repeats every 30 days.
42 */
43export const decideEmails = (input: NotifierInput): NotifierResult => {
44 const {adminEmail, current, latest, isSevere, state, now} = input;
45
46 if (!adminEmail) return {toSend: [], newState: state};
47
48 const toSend: PlannedEmail[] = [];
49 const newState: EmailSendLog = {...state};
50
51 if (isSevere) {
52 const sinceSevere = sinceMs(state.severeAt, now);
53 if (sinceSevere >= SEVERE_INTERVAL) {
54 toSend.push({
55 kind: 'severe',
56 subject: `[Etherpad] Your instance is outdated (${current})`,
57 body: `Your Etherpad version (${current}) is at least one minor release behind the latest published version (${latest}). Consider scheduling an upgrade.`,
58 });
59 newState.severeAt = now.toISOString();
60 }
61 }
62
63 return {toSend, newState};
64};
65
66export type FailureOutcome =
67 | 'preflight-failed'

Callers 2

Notifier.test.tsFile · 0.90
performCheckFunction · 0.90

Calls 2

sinceMsFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected