Format admin notifications with unified subject prefix

This commit is contained in:
Remi
2025-09-17 17:45:05 +02:00
committed by itsrubberduck
parent 8366845f15
commit 09481b6bfa
4 changed files with 179 additions and 33 deletions

View File

@@ -44,14 +44,18 @@ export default defineEventHandler(async (event) => {
consentPrivacy: true,
})
const lines = [
`Titel: ${title}`,
`Beschreibung: ${details}`,
`Kontakt: ${email || '—'}`,
allowContact ? 'Kontaktaufnahme erwünscht' : 'Keine Kontaktaufnahme erwünscht',
const dataEntries = [
['Titel', title],
['Beschreibung', details],
['E-Mail', email || null],
['Kontaktaufnahme erlaubt', allowContact],
]
await sendAdminNotification('[OpenSquawk] Neuer Roadmap-Vorschlag', lines.join('\n'))
await sendAdminNotification({
event: 'Neuer Roadmap-Vorschlag',
summary: `Neuer Roadmap-Vorschlag: ${title}`,
data: dataEntries,
})
return {
success: true,

View File

@@ -37,12 +37,16 @@ export default defineEventHandler(async (event) => {
})
if (result.created) {
const lines = [
`E-Mail: ${email}`,
name ? `Name: ${name}` : null,
`Quelle: ${source}`,
].filter(Boolean)
await sendAdminNotification('[OpenSquawk] Neue Updates-Liste', lines.join('\n'))
const dataEntries = [
['E-Mail', email],
['Name', name || null],
['Quelle', source],
]
await sendAdminNotification({
event: 'Neue Updates-Liste',
summary: `Neue Updates-Anmeldung: ${email}`,
data: dataEntries,
})
}
return {

View File

@@ -56,16 +56,23 @@ export default defineEventHandler(async (event) => {
})
if (!previouslyWantedUpdates && updateResult.created) {
const lines = [
`E-Mail: ${email}`,
name ? `Name: ${name}` : null,
notes ? `Notizen: ${notes}` : null,
`Quelle: ${source}`,
].filter(Boolean)
await sendAdminNotification(
'[OpenSquawk] Neue Updates-Liste (via Warteliste)',
`${lines.join('\n')}\nOpt-In: Produkt-Updates`,
)
const dataEntries = [
['E-Mail', email],
]
if (name) {
dataEntries.push(['Name', name])
}
if (notes) {
dataEntries.push(['Notizen', notes])
}
dataEntries.push(['Quelle', source])
dataEntries.push(['Opt-In', 'Produkt-Updates'])
await sendAdminNotification({
event: 'Neue Updates-Liste (via Warteliste)',
summary: `Produkt-Updates Opt-in (Warteliste): ${email}`,
data: dataEntries,
})
}
}
@@ -98,14 +105,23 @@ export default defineEventHandler(async (event) => {
})
}
const lines = [
`E-Mail: ${email}`,
name ? `Name: ${name}` : null,
notes ? `Notizen: ${notes}` : null,
`Quelle: ${source}`,
wantsProductUpdates ? 'Opt-In: Produkt-Updates' : 'Opt-In: nur Warteliste',
].filter(Boolean)
await sendAdminNotification('[OpenSquawk] Neue Wartelisten-Anmeldung', lines.join('\n'))
const dataEntries = [
['E-Mail', email],
]
if (name) {
dataEntries.push(['Name', name])
}
if (notes) {
dataEntries.push(['Notizen', notes])
}
dataEntries.push(['Quelle', source])
dataEntries.push(['Opt-In', wantsProductUpdates ? 'Produkt-Updates' : 'Nur Warteliste'])
await sendAdminNotification({
event: 'Neue Wartelisten-Anmeldung',
summary: `Neue Wartelisten-Anmeldung: ${email}`,
data: dataEntries,
})
return {
success: true,