Analyse: Zielgruppen-Bestätigung in Historie, Rücknahme bei Fehler nach Dokument-Update, handelnde Person mit Name und E-Mail

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-01 18:50:36 +00:00
1 parent 3d05472b25
commit f401dc14d7
7 files changed
+108 -56

No files matched your search

+1
View File
@@ -81,6 +81,7 @@ router.post('/:projectId', async (req, res) => {
consent: { accepted: true, avvVersion: config.analyse.avvVersion },
by,
textform,
audienceConfirmed,
})
: await deactivateAnalyse({ customerId, projectId: project.$id, by })
res.json({ ok: true, state: doc?.state || 'off' })
+8 -2
View File
@@ -37,6 +37,12 @@ function fail(res, err, fallback) {
return res.status(500).json({ error: fallback })
}
// Handelnde Person: bei Admin-Sitzung (adminName/adminEmail, siehe auth.js) der Admin, sonst der Kunde
const actingPerson = (session) =>
session.adminName || session.adminEmail
? { name: session.adminName, email: session.adminEmail }
: { name: session.name, email: session.email }
const ANALYSE_OFF = 'Website-Analyse ist noch nicht freigeschaltet'
const ANALYSE_ERROR = 'Die Website-Analyse konnte gerade nicht geändert werden. Bitte versuch es später noch einmal oder schreib uns im Chat.'
@@ -183,7 +189,7 @@ router.post('/analyse/activate', analyseGuard, async (req, res) => {
accentColor,
consent,
by: 'customer',
actor: { name: req.session.name, email: req.session.email },
actor: actingPerson(req.session),
})
res.json({ ok: true, state: doc.state })
} catch (err) {
@@ -200,7 +206,7 @@ router.post('/analyse/deactivate', analyseGuard, async (req, res) => {
customerId: getSessionCustomerId(req),
projectId: analyseProjectId(req.body?.projectId),
by: 'customer',
actor: { name: req.session.name, email: req.session.email },
actor: actingPerson(req.session),
})
res.json({ ok: true, state: doc?.state || 'off' })
} catch (err) {