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:
@@ -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),
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user