Commit Graph

5 Commits

Author SHA1 Message Date
Claude
751d452556
Fijar: moderators choose what gets read first
Half of this already existed and nothing said so. `threads.pinned` has
been in the schema since the board shipped, with an index on it and a
toggle route, but it was @admin_required, reachable only from inside a
thread, and Inicio ignored it.

Who. Moderators and above, on both halves. Curating what the public
reads is the whole of a moderator's job, and content.py has said so
since the queue was built. Locking a thread rides the same route and is
still an admin's: it stops named people saying anything more to each
other, which is power over people rather than over content, and this
codebase keeps those apart everywhere else.

What is stored. A moment, not a flag — several posts can be pinned and
the newest pin goes first, so the value is the order. `pinned:
'2026-10-13T12:00:00'` in a post's own frontmatter, written only when
true; `threads.pinned_at` beside the flag the wall already had, cleared
on unpinning so that pinning again puts it where a new pin belongs. One
key carrying both means `{{ if .Params.pinned }}` still reads as a
yes/no and nothing has to be kept in step with anything.

translate.py needs nothing: it copies the whole frontmatter and rewrites
only TRANSLATED_KEYS, so a pinned post is pinned in German too. Asserted
against the real list rather than assumed.

Two ways to pin a public post — the switch beside Publicar, and one
press in the Contenido list, because deciding what the site leads with
means looking at the list rather than opening each post to find out what
is in it. Both commit; the file is the record.

Migration 10 adds the columns and recreates the wall's index, which now
names pinned_at. `CREATE INDEX IF NOT EXISTS` leaves an existing index
exactly as it is, so without that a running server keeps the old
definition forever while a fresh install gets the new one. Nothing
breaks either way, which is the problem.

Checked rather than assumed: built with Hugo 0.135.0 and the pipeline's
flags, two pinned posts come out above a newer unpinned one and in
pin order rather than post order, with the pill on the cards and on the
article. And the wall rendered at 390px, where the pinned thread leads
and nothing overflows.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-10-13 18:24:32 +00:00
Claude
3e610ac5d2
A title nobody has to write, a fold, a switch and a button
Four changes to the forms people write in.

**The title is optional**, and says nothing about it: a field labelled
«(opcional)» is a field asking to be filled in. An untitled post is
«Sin Título» and the next is «Sin Título 2», so a list of them can still
be told apart and linked to. apps/board/titles.py holds the rule.

The numbering is done per place, against what is already there. The wall
and the queue count every title in the table, deleted rows included — a
number that comes back is a thread that looks like one somebody
remembers reading. A public post counts the *filenames* in its folder
instead, because that is what collides in a repository: two untitled
posts on one day would both be `<fecha>-sin-titulo.es.md`, and the
second would have failed as "somebody else saved this file while you
were editing it", which is a message about a conflict that never
happened. Clearing the title on an edit excludes the file being edited
from its own check, so saving three times does not rename it three
times.

**The event box folds away.** Most posts are not events, and three date
pickers between the title and the text are three fields most people
scroll past. A <details>, like the account menu, so no script is
involved; it opens by itself when the post already has a date.

**The AI disclosure is a switch** rather than a checkbox — what it says
is a statement about the text, not a detail of the form, and it should
look like something that is on or off. Drawn entirely from the
checkbox's own :checked state: under a policy with no 'unsafe-inline' a
control that needs a script is a control that silently does nothing. The
input stays in the tab order and keeps its label, so it works from a
keyboard, and it is anchored inside its own label rather than left
adrift over the page.

**Cancelar is a button**, and Vista previa beside it is shaped the same:
leaving is the other half of a decision and should be the same size as
the half next to it. Quiet rather than filled, so the eye still knows
which one publishes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-10-06 20:58:33 +00:00
Claude
ff115c1d6b
A post can say that a machine wrote it
A switch beside the button that publishes — on the editor, on a member's
proposal and on a wall thread — and a pill next to the date wherever the
post is read: the article, the cards in the listings, the thread, the
wall's list, and the moderator's review screen. Next to the date rather
than under the text, because a disclosure somebody meets after reading
the thing is not a disclosure.

Where it lives follows what the thing is. A public post carries
`ai_generated: true` in its own frontmatter, written only when true —
the file in the repository is the record, and `ai_generated: false` on
every post ever written is noise in git and a question in the mind of
whoever reads one. A thread carries a column. A proposal carries a
column too, and that is the one place it has to be moved by hand: a
proposal is a draft in SQLite until it is approved, so the frontmatter
it will end up in does not exist while the decision is being made, and
losing it there would lose it exactly when the text stops being private.

`content.edit` loads the flag back into the form, for the same reason
the byline is carried through: a field read but not written back is a
field that one corrected typo silently removes.

The pipeline needs nothing. translate.py copies the whole frontmatter
and rewrites only TRANSLATED_KEYS, so the flag reaches the German and
Portuguese siblings by itself — right rather than lucky, since a
translated post was still machine-written. Asserted against the real
list, so a key quietly added to it fails the suite.

Migration 9: three plain ADD COLUMNs, tested against a database with a
thread, a proposal and a cached post already in it.

The three words are in partials/t.html with the theme's other labels.
This is also the shape the EU AI Act's Article 50 asks for, which is
worth knowing for whoever installs this for a second organisation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-10-06 20:19:06 +00:00
Claude
c84a996eef
The bar, the share card, the writing box and subpages
**A signed-in member sees the members area from anywhere.** A slim bar above the
public header, with the same five sections /comunidad/ has. Those pages are
files on disk and get cached, so it is drawn in the browser: memberbar.js asks
/comunidad/sesion.json who is reading, and that endpoint is the only thing that
decides — a visitor is told `{"signed_in": false}` and the answer is never
cached. Sign-in also sets vl_sesion=1, a cookie holding one digit that scripts
can read, and without it the script makes no request at all: a stranger reading
one article costs the app nothing. It is a hint, never a credential — the
session cookie stays HttpOnly and signed, and a forged hint earns a reply saying
you are not signed in. Comunidad is now in the public menu in all three
languages, signed in or not.

**The public menu is built from the pages.** It was three names per language in
config.yaml, so a page published through Contenido never appeared on the site at
all and the German and Portuguese menus had to be kept in step by hand. Pages
carry `parent` (another page's basename — the one translate.py already uses to
pair siblings, so it holds in all three languages) and `weight`, both chosen in
the editor, and header.html builds two levels from them. URLs do not change: a
subpage is still /page/<slug>/, only the menu nests, so nothing in the Caddyfile
or the pipeline learns about folders. The dropdown is the theme's own, ported
from WordPress — hover, focus-within, inline on a phone, no script. A parent that
has been deleted is kept and labelled rather than silently dropped on the next
save.

**Sharing and the rest of SEO/GEO.** The groundwork was already here — hreflang,
Open Graph, Twitter card, BlogPosting, llms.txt, robots.txt naming the AI
crawlers — so this closes the gaps. Static pages had *none* of it and shared as
bare links; they now carry WebPage schema and the full set of tags. Both branches
gain og:image with an alt and a twitter:image, falling back to params.defaultImage
(empty until there is a logo, which is the one line to fill in then). The home
page gains Organization with areaServed Wien and a sameAs list; posts and pages
gain BreadcrumbList, and an article's structured data now carries the author's
profile URL. An optional FAQ — `pregunta|respuesta` per line — renders at the
foot of the page and as FAQPage schema, because current guidance for generative
engines puts exactly that shape at the top of what gets quoted, and schema
describing something invisible is what search engines penalise. translate.py
carries both new fields: image_alt joins the translated keys, and faq is
translated half by half so the separator survives.

**The writing boxes.** A markdown toolbar and a Vista previa on every box where
somebody writes prose, opted in with data-markdown. The preview POSTs to
/comunidad/previsualizar and renders with render.to_html — the same function the
board and the site use, so it cannot promise something publishing will not
deliver; a markdown parser in the browser would be a second opinion about what
somebody's text means. Choosing a picture now shows a thumbnail with its name and
size before anything is uploaded, which is the only reason `blob:` joins img-src:
a handle to bytes already in the page, reaching no network.

All of it ours, no dependency added, under a policy that loads scripts from this
origin only. Verified by building the site with Hugo 0.135, the version the
pipeline runs: the nested menu, the page's share tags, the FAQ schema matching
the rendered section, and llms.txt listing the pages.

463 tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-10-02 15:21:35 +00:00
Claude
6ac814475e
Add a members area: roles and an internal board
Everything on this site so far has been a file built from git. This is the
first component that runs code to answer a request and the first whose data
git does not hold, so the trade is stated in the README and the backup script
is not optional.

Roles are owner, admin and user. The owner is seeded once from BOARD_OWNER and
cannot be seeded again, because otherwise editing a compose file would be a
quieter way to take the top role than asking for it; ownership moves only by
transfer, inside the app. There is exactly one owner and a partial unique index
enforces it, so the invariant holds even when a handler is wrong. The owner is
beyond suspension and demotion by everyone, themselves included. Only the owner
makes admins; admins make users.

Sign-in goes through Gitea as a confidential OAuth client — the opposite of
Decap, which has to be public because it runs in the browser. The rule the
whole thing rests on is that a Gitea account is not a membership: entry needs
an active row in `members`, or every account on the instance is a member,
starting with the translations bot.

Admins can delete any post; nobody can edit anyone else's, admins included.
Taking a post down is visible to its author. Quietly rewriting it is not, and
an admin who could do that could leave a sentence attributed to someone who
never wrote it. The plan said admins could do both; this is the one place the
implementation departs from it.

Markdown renders with raw HTML disabled, which is the entire XSS defence and
the reason there is no sanitiser: the renderer emits only its own tags and
escapes the rest. The CSP carries no 'unsafe-inline', which makes an inline
onsubmit silently inert rather than broken, so the confirmation dialogs live in
a static file and a test fails any template that grows an inline handler.

GDPR is in scope rather than deferred: erasure removes the member row and moves
their authorship to a tombstone so the conversations around them still read,
and any member can download their own writing.

Verified: 63 checks pass, covering the membership gate, every role predicate, a
direct insert of a second owner being refused by the index, atomic ownership
transfer, CSRF, an offsite login redirect, script tags rendering as text, soft
deletes leaving both listings and exports, and the member screens rendering for
each role. Smoke-tested live: headers, both static assets, and the bare
/comunidad redirect that the Caddy matcher has to cover.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-09-22 10:57:18 +00:00