Newsletter drafts with content blocks, a footer and Post as blog post; Home has no header dropdown

Tools → Newsletter saves drafts (migration 057: newsletters, with
content blocks owned 'newsletter'), adds blocks written for the issue
and an editable footer (no unsubscribe link: Mailchimp adds one), and
turns a draft into an unpublished blog post. The admin engine binds
child owner ids as text, so an auto-numbered record's blocks are
owned by '1', not '1.0'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-01 00:21:32 -05:00
parent 9daf7b1a4f
commit e8ac242e6d
8 changed files with 575 additions and 34 deletions

View file

@ -189,8 +189,9 @@ export function readRow(db, entity, rawId) {
row[ext.key] = readExtension(db, ext, id);
}
// As text, for the reason readChildren gives its nested ids.
for (const child of entity.children ?? []) {
row[child.key] = readChildren(db, child, id);
row[child.key] = readChildren(db, child, String(id));
}
return row;
@ -513,7 +514,10 @@ function keyedDbErrors(prefix, fn) {
}
}
function writeChildren(db, entity, id, payload, parentValues) {
function writeChildren(db, entity, rawId, payload, parentValues) {
// As text: an auto id is a JS number, which binds as REAL and
// lands in a TEXT owner column (a newsletter's blocks) as '1.0'.
const id = String(rawId);
for (const child of entity.children ?? []) {
if (!applies(child.when, parentValues)) {
deleteChildren(db, child, id);