feat(projects): flag re-rendered emails in the feed

Each email in the rollup now carries a 'stored' flag (rendered_html present).
Emails without an exact stored copy show an amber '≈ re-rendered' tag next to
Preview, so it's visible at a glance — not just inside the modal. en + de.
This commit is contained in:
Luca
2026-06-06 22:50:03 +02:00
parent f02fba6332
commit 94f2c01590
5 changed files with 21 additions and 4 deletions
+5 -1
View File
@@ -255,12 +255,16 @@ async function getProjectOverview(id, perms = {}) {
});
}
})
.select('id', 'recipient_email', 'email_type', 'status', 'created_at', 'sent_at', 'error_message', 'event_id')
.select('id', 'recipient_email', 'email_type', 'status', 'created_at', 'sent_at', 'error_message', 'event_id',
// Exact stored preview available? (CASE is cross-DB: SQLite→0/1, PG→int)
db.raw('CASE WHEN rendered_html IS NOT NULL THEN 1 ELSE 0 END as has_rendered'))
.orderBy('created_at', 'desc')
.limit(200);
out.emails = emails.map((e) => ({
id: e.id, recipient: e.recipient_email, type: e.email_type, status: e.status,
queuedAt: e.created_at, sentAt: e.sent_at, error: e.error_message, eventId: e.event_id,
// false → the cockpit preview will re-render from the current template.
stored: !!Number(e.has_rendered),
}));
}