Files
StarPunk/docs/design/v1.6.0/display-moderation.md
PhilandClaude Opus 5.5 0716984958 docs: Bring all documentation up to date for v2.10.1
- architecture/: overview, technology stack, auth (OIDC + built-in
  IndieAuth), syndication (POSSE) rewritten; new database.md,
  deployment.md and indieweb-protocols.md; legacy stack marked historical
- decisions/: reconstructed ADR-060 and ADR-063; 31 status corrections
  (superseded auth ADRs, proposed -> accepted); INDEX rebuilt
- design/: reconstructed the v1.6.0 documents the webmention code cites;
  reports for 18 v2 releases without a design folder; INDEX rebuilt
- projectplan/: BACKLOG rewritten (shipped items removed, open issues from
  the reviews added); RELEASE.md for v2.0.0-v2.10.1; INDEX
- standards/: development setup (uv, tests, DEV_MODE), testing (CI test
  stage), git and release flow, versioning, coding standards, cookies
- README, CLAUDE.md, .env.example (every setting the code reads, with
  defaults) brought up to date
- 137 broken links repaired (old absolute paths, moved files); stale ADR
  references in code comments corrected (comments only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:40:19 -07:00

4.4 KiB
Raw Permalink Blame History

v1.6.0 Design: Webmention Display and Moderation

Reconstructed on 2026-11-03 from the implementation; the original v1.6.0 document was lost. Later changes: v2.6.8–v2.7.2 (see CHANGELOG). Display markup was reworked in v2.8.0 (microformats2 review). Describes starpunk/webmention_queries.py, starpunk/routes/admin.py, starpunk/routes/public.py, templates/note.html and templates/partials/responses.html as of v2.10.1.

Related: ADR-063, background-worker.md, database-schema.md.

States

A received webmention has two independent states:

  • validation_status (set by the worker): pending, valid, invalid, error.
  • moderation_status (set by the worker on first validation, then by the admin): pending, approved, hidden (deleted exists in the schema but deleting removes the row).

A webmention is shown only when valid AND approved. WEBMENTION_AUTO_APPROVE=true (default) makes a first-time valid mention approved; with false it waits as pending for the admin. Re-validation of a previously valid mention keeps the admin's decision (v2.7.0).

Public display

get_webmentions_for_note(note_id) returns shown webmentions for a note, ordered by type (reply, like, repost, bookmark, mention) then received_at ascending, grouped into replies, likes, reposts, bookmarks, mentions. received_at and source_published are parsed to datetimes (unparseable source_published becomes None).

routes/public.note loads them only when WEBMENTION_ENABLED; errors are logged and the page renders without them. The "Webmentions" section is rendered only if at least one group is non-empty, with a heading and count per group.

Markup (v2.8.0, partials/responses.html), each response an h-cite in a property of the note's h-entry:

Group Property Presentation
Replies u-comment h-cite Author card (name, link, 48px photo), sanitised e-content snippet, date link
Likes, reposts, bookmarks u-like / u-repost / u-bookmark h-cite Facepile of 32px photos (or a coloured initial); faces after the 8th are hidden on screen but stay in the markup for parsers, with "+N others"
Mentions u-mention h-cite Small author card, snippet with tags stripped and truncated to 200 chars
  • The response's link is the source's u-url (source_post_url) if given, else the webmention source; its date is source_published, else received_at, in UTC with Z.
  • The author h-card puts u-url on an inner link, so it isn't read as the h-cite's URL.
  • Snippets are stored sanitised (see api-contract.md) and output with |safe; all other fields are autoescaped.

Admin moderation

All routes @require_auth, under /admin:

Route Purpose
GET /admin/webmentions?status=&page= List, newest received first, 25 per page; filter tabs All / Pending / Approved / Hidden (by moderation_status)
GET /admin/webmentions/<id> Detail: source, target (note link), type, author, snippet, validation status and error, timestamps, actions
POST /admin/webmentions/<id>/action action = approve / hide / delete
POST /admin/webmentions/bulk-action Same actions for ids (checkboxes)

The dashboard shows a badge with the number of pending (moderation) webmentions.

Query functions: list_webmentions, get_webmention, count_webmentions, update_webmention_status(ids, status) (only approved, hidden, pending), delete_webmentions(ids) (hard delete).

Moderation changes re-send webmentions (v2.7.2, spec 3.1.4)

Before an update or delete, _visibility_changes() finds the target notes of valid webmentions whose shown/not-shown state changes. After the commit, _notify_responses_changed() calls webmention_sender.note_responses_changed(), which re-queues every webmention the (published, undeleted) note sent before. Best effort: failures are logged.

Known limits

  • The admin list filters and shows only moderation status; validation status and error appear on the detail page. A mention that never validated keeps the default moderation_status = 'pending', so it is listed under Pending and counted in the dashboard badge although there is nothing to approve.
  • A webmention re-sent by its source is pending until the worker re-validates it (seconds), and is not shown during that time.
  • Hidden or invalid webmentions are kept indefinitely; there is no pruning.