Add a Featured Content section to the front page

Front page → Featured cards (migration 030) holds cards of three
kinds: a record on the site, whose title, picture and link fill in
from the record; a link, with a Fetch preview button that reads the
page's title, description and preview image into the media library;
and a video, drawn as a thumbnail that loads the player when pressed.
A 'featured' section draws them.

The cards are shared: featured_cards is owned polymorphically and
FeaturedCards.tsx draws them, ready for the Community blog. Deleting
a record removes its cards; an unpublished record's card is hidden.

The preview fetch only goes to public http(s) addresses on standard
ports, pinned to the vetted IP, with each redirect checked again.

Along the way: repeater fields can show by another field's value (a
hidden one is cleared), a CHECK named as a sentence is shown as the
error, and the timeline's record list is now record_refs for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 15:56:29 -05:00
parent 960c854611
commit d4f65d93b4
17 changed files with 1140 additions and 50 deletions

View file

@ -628,9 +628,14 @@ function wrapDbErrors(fn) {
);
}
const check = /CHECK constraint failed: (\w+)/.exec(message);
// A CHECK named with a sentence (CONSTRAINT "A link or video
// card needs a URL." CHECK ...) is its own message. Anything else
// is named by the first word of its expression.
const check = /CHECK constraint failed: (.+)$/.exec(message);
if (check) {
throw new HttpError(422, `A value was rejected by the "${check[1]}" rule.`);
const name = check[1].trim();
if (/\s/.test(name) && /[.!?]$/.test(name)) throw new HttpError(422, name);
throw new HttpError(422, `A value was rejected by the "${name.split(/\W/)[0]}" rule.`);
}
// The polymorphic tables stand in for a foreign key with a