3f0aa7ae61
7 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
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 |
||
|
|
8e1ef8831c
|
The writing box shows the formatting, and raw HTML stops reaching the site
The box is now the finished text: bold is bold, a heading is a heading, a
list is a list. No preview pane — a second box beside the first is the
wrong shape on a phone — and nothing is sent anywhere while anybody
types, so the round trip the old «Vista previa» button made on every
press is gone.
Markdown is still the only thing stored, which is what keeps the file in
git, the translation pipeline, Decap and the XSS defence exactly as they
were. The two directions are deliberately not symmetrical:
opening — the server renders the stored markdown into a <template>
the editor adopts, so there is no markdown parser in the
browser and no second opinion about what text means;
saving — the browser walks a closed set of elements back into
markdown. Anything else contributes its text and nothing
more, which is why a paste brings no markup in.
Three heading levels (## ### ####), bold, italic, strikethrough, two
kinds of list, quote, link and clear formatting on the four post boxes;
bold, italic, link and clear on the short ones. A «Markdown» button
swaps to the raw text and back — the escape hatch, and the way to write
a table. With JavaScript off the plain textarea is still there and still
the field that submits; verified by driving the form with scripting
disabled.
Headings had no styles anywhere. `.article-single__body` styled `p` and
nothing else, so three levels would have rendered as three identical
bold lines. Both stylesheets now carry the ladder, along with lists,
quotes and rules.
Two renderer findings, both of which richer writing makes worse:
- config.yaml set Goldmark `unsafe: true`, for WordPress content that
no longer exists — no file under content/ holds a tag. A member's
proposal containing `<img src=x onerror=…>` renders as visible
characters in the moderation queue, which is the one screen a
moderator judges it on, and that flag is what would have run it on
the live site. Off now; the built output is byte-identical.
- A line break meant two things: `breaks: True` here, Goldmark's
hardWraps off there. Turning hardWraps on was the obvious fix and
the wrong one — the files are hard-wrapped at 78 characters, so it
would break every sentence in half. Instead there are two renderers,
one per destination, and the editor writes the hard break CommonMark
means (two spaces) so it survives either way.
Tested by running the serializer itself, in node, against the same
static/board.js the browser loads: 26 cases including the ones that go
wrong — a pasted span, a script, an empty box, a line starting with «-»,
a javascript: href — plus a round trip asserting markdown → HTML →
markdown renders identically for ten real documents.
Then by typing in a browser at 390px with touch emulation, which is what
found the one defect no fixture predicted: pressing Enter in a list
wraps it in a <div>, and reading that as a paragraph ran «uno» and «dos»
together into one word.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
|
||
|
c2154b6f06
|
A phone can use this site, and the way in is a button
Your screenshot had no navigation at all: brand, three language letters, posts.
The cause is one missing button, and the CSS has been waiting for it since the
WordPress port. `main.css` hid `.site-bar__pages` below 768px and showed it
again on a class, and styled a `.site-bar__hamburger` — the panel's styles, the
button's styles and the animated ✕ were all ported, and the button itself never
was. Nothing in the theme has ever set that class. So for three phases every
phone saw the site with no menu, with every rule involved correct and every
selector pointing at an element that did not exist.
The toggle is a visually hidden checkbox immediately before the menu, with the ☰
as a `<label>` for it in the bar, and one rule doing the work. No JavaScript.
Not `<details>`, which is this project's usual answer and does not work here: on
desktop the menu has to be open and horizontal, and current Chrome hides a
closed `<details>`'s content with `content-visibility` on `::details-content`,
which a `display` rule on the child no longer overrides. A checkbox behaves the
same in every engine, keeps its place in the tab order and keeps its label.
`test_templates.py` now fails if the stylesheet hides the menu behind a state
the header does not carry — the shape of bug this suite keeps meeting, and the
first time it is guarded rather than found by looking.
**Comunidad is a button in the bar** at every width, brand-coloured through the
tokens Marca writes, instead of a word in a menu that on a phone would not open.
Its three translations moved from the `menus.main` blocks into `t.html`: the URL
is the same in every language, so the menu entry was only carrying a label. The
language switcher is rendered twice, in the bar and at the foot of the panel —
a brand, a button, a ☰ and three language letters do not fit across 360px and
CSS cannot move an element between the two.
**Categories and tags are gone**, both taxonomies. Nothing downstream had to
change: the agenda, the event page, the .ics and the private calendar already
keyed on `event_date` rather than on the category, which I checked before
removing anything. The category was only a gate in the editor, so the gate goes
too — **a post carrying a date is an event**, with nothing to tick first and no
way left to say "this is an event" and then not say when. Migration 6 drops the
two columns that held the terms.
`taxonomies: {}` rather than no `taxonomies` key: leaving the key out restores
Hugo's own defaults, which are tags and categories, so deleting the block built
the very pages it was meant to remove.
Also here, found while looking at the output rather than assumed: the breadcrumb
schema emitted a subpage's parent and the page itself both at position 2, and
the members area's six-section nav had no wrap and no scroll, so `/comunidad/`
on a phone scrolled sideways. It wraps now — two lines showing all six, where a
swipe strip would have left Calendario and Gestión off the edge with nothing to
say they were there.
Verified by rendering: headless Chromium at 320px, 390px and 1280px, before and
after opening the menu, and the members area at 390px. No horizontal overflow at
any of them. 548 tests pass; the build is clean with the pipeline's own flags.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
|
|||
|
|
5e8ee5ad20
|
Two calendars: one for everybody, one for the members
**Public events are posts.** A new Evento category brings three fields with it — event_date, event_time, event_location — and the first is required, because a post's own `date` is when it was announced and an event announced three weeks early would otherwise land in the agenda on the wrong day. Members propose events through the same queue as everything else, and the date survives approval untouched: the event the member described is the event that gets published. An event's page leads with the day, the time and the place before the title, shows its picture full width, and offers "añadir a mi calendario" — a real .ics beside the page, generated because the editor writes `outputs: ["HTML", "ics"]` into an event's frontmatter and nothing else asks for that format. It carries Event structured data as well as the BlogPosting it already had, which is what puts a date beside the result in a search listing. /page/agenda/ is a month grid per month, every month from the first event to the last built at build time, with a script that shows one and moves between them. That arrangement is the point: with JavaScript off every month is on the page as a list, with it on nothing is fetched to change months, and the month it opens on is the reader's rather than the one the site was built in. Hugo exposes no AddDate, so the length of a month is a table plus the leap rule and the first weekday falls out of formatting the date — it looks like something simpler was missed, and it is not. **The private calendar** is a sixth section: rows in SQLite, written by admins, read by every member, never published. It shows the public events too, marked, so a member has one place to look rather than two — they come from the content_cache the editor's listing already fills, which is why migration 5 adds three columns to it and to submissions. The grid is Python's own calendar.Calendar: no date arithmetic of mine anywhere in it. Two things the tests found on the way: gitea.py let `requests`' own exceptions through. They inherit from OSError, not from GiteaError, so the calendar's careful "keep working while the git server is down" would have been defeated by a refused connection — the page would have 500ed instead. Every transport failure is now a GiteaError, raised at the one place that touches the wire. This is the third bug of exactly that shape in this module. An admin's erasure clears events.created_by rather than reassigning it. The meeting still happens after they leave; the event belongs to the association. 509 tests pass, and the site builds with Hugo 0.135.0 under the pipeline's own --panicOnWarning. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn |
||
|
|
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
|
||
|
|
5ea6b1ac98
|
One dashboard, five sections, and a moderation queue
The members area had grown one navigation entry per phase, and three of the five were inside an admin-only block in base.html — so an ordinary member signed in to a wall and a member list, with their own profile, their own private messages and the content editor all invisible. Everything worked and nothing was reachable. That is the bug this starts from. The navigation is now Inicio · Muro · Privados · Publicaciones, plus Gestión for admins, and the account items (Mi perfil, Descargar mis datos, Salir) moved to a menu under the member's own name — a <details> element, because the CSP has no 'unsafe-inline' and a menu needing onclick="" silently never opens. Inicio is a new dashboard; the wall moved from /comunidad/ to /comunidad/muro and kept its thread URLs. test_navigation.py asserts the navigation per role from the rendered page, so this cannot come back quietly. Public posts are now curated. A member proposes one and it waits in a new `submissions` table; a moderator or admin approves it — which commits it through content.publish, the same function the editor uses, with the author named per commit so git history says who wrote it, not who approved it — or returns it with a reason the author reads. Moderators and admins do not queue. Nothing a member writes reaches the repository before approval, because a commit to it *is* publication: the webhook starts the pipeline. A proposal's picture stays private in /data/uploads until then, and the private copy goes when the public one is committed. There is deliberately no way to promote a wall thread into a proposal. The moderator role needed the role CHECK widened, and SQLite has no DROP CONSTRAINT, so migration 4 rebuilds `members` — eight tables reference it, the one-owner index has to be recreated by hand, and PRAGMA foreign_key_check runs before the commit. One trap worth recording: the allowed roles can only be read back out of sqlite_master's verbatim CREATE TABLE text, comments included, so schema.sql's own comment explaining the rebuild made the step decide it had already run. The start-up test caught it; comments are stripped now. A moderator curates content and has no power over people: no creating, suspending, promoting or erasing anybody. set_role moved from owner-only to admin-level so moderators can be appointed routinely, and checks may_create on the new role as well, so admins still cannot mint admins. content.py splits per collection — posts need a moderator, the site's static pages need an admin. Also: erasure deletes a member's submissions and their pictures and clears reviewed_by, which the existing foreign-key guard forced; deploy-board.sh takes a backup before restarting, since two migrations now rebuild a table in place and one of them holds your own account; README and docs/server-setup.md updated for the roles, the sections and migration 4. 370 tests pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn |