Commit Graph

3 Commits

Author SHA1 Message Date
Claude
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
2026-09-30 11:09:55 +00:00
Claude
e11016a8e9
Refuse before the form, not after the password
A member followed his invitation link, chose a password, typed it twice,
pressed save, and was shown the name of an environment variable. The
server knew from the first byte of that request that it could not save
anything: without GITEA_ADMIN_TOKEN it cannot set a password in Gitea.
It asked him to do the work anyway.

Three places had the same shape, all now checked up front through a new
gitea.admin_configured(), mirroring mail.configured():

- the invitation page answers 503 with an explanation and no password
  field, identically for a real and an invented token so it cannot be
  used to probe for live ones
- /recuperar refuses instead of mailing a link to a page that could only
  apologise — and its deliberately identical answer would have hidden
  that from the admin as well as the member
- the sign-in page stops offering recovery it cannot complete

Also: a 404 from admin_set_password now names the real cause. A member
added without "crear también su cuenta" has no Gitea account, so the
password change is aimed at nothing, and "Gitea rechazó el cambio de
contraseña (404)" blames Gitea for an account that was never made.

deploy-board.sh warns about settings that are present but empty. The
previous check looked for missing names, and GITEA_ADMIN_TOKEN= has a
name — which is why the deploy that led to this said nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-09-25 19:20:44 +00:00
Claude
ed6b568d60
Hand the mail settings to the container, and rebuild on deploy
Two silent failures sitting between Phase A and a working invitation.

The compose file never passed MAIL_* through. Compose does not give a
container the contents of .env — it only substitutes into the compose
file — so the settings could be filled in correctly and read by nobody,
with the app reporting mail as unconfigured and the values sitting right
there on disk. test_deployment.py now fails the build whenever
.env.example and docker-compose.yml drift apart, which is how this
happened and how it would happen again.

The app's code is baked into the image (COPY apps /srv/apps), so a pull
followed by --force-recreate runs the old code and says nothing. Added
scripts/deploy-board.sh: rebuild, sync the compose file, restart, print
the log, and name any setting present in .env.example and missing from
the live .env. It never touches .env itself.

Also: "no mail server configured" is now told apart from "the mail
server refused". They want different things done about them, and the
first one sent an admin looking for an SMTP error that never existed.
The new-member form says so before it is filled in rather than after.

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