vienalatina/apps/board/templates/base.html
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

84 lines
3.3 KiB
HTML

{# Chrome deliberately mirrors the public site's header and footer, so moving
between vienalatina.com and the members area does not feel like leaving. #}
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<title>{% block title %}Comunidad{% endblock %} — Viena Latina</title>
<link rel="stylesheet" href="{{ url_for('static', filename='board.css') }}">
<script src="{{ url_for('static', filename='board.js') }}" defer></script>
</head>
<body>
<header class="site-bar">
<div class="site-bar__inner">
<a class="site-bar__brand" href="/"><span class="site-bar__brand-text">Viena Latina</span></a>
{% if g.member %}
{# <details> rather than a button with a handler: the CSP has no
'unsafe-inline', so a menu that needs onclick="" is a menu that
silently never opens. This one works with the CSS and the HTML
alone. #}
<details class="account">
<summary class="account__name">{{ g.member.display_name }}</summary>
<div class="account__menu">
<a href="{{ url_for('profiles.edit') }}">Mi perfil</a>
<a href="{{ url_for('members.export') }}">Descargar mis datos</a>
<form method="post" action="{{ url_for('auth.logout') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="linkish" type="submit">Salir</button>
</form>
</div>
</details>
{% endif %}
</div>
{% if g.member %}
<nav class="site-bar__pages" aria-label="Secciones">
{# Five entries, and four of them are the same for everybody. The role
only decides whether Gestión is there — it used to decide three of
them, which is how an ordinary member ended up signing in to a wall
and a member list with their own profile and their own private
messages hidden from them. Account items are in the corner menu
above, because "Mi perfil" is not a section of the site. #}
<ul class="page-nav">
<li><a href="{{ url_for('home.index') }}">Inicio</a></li>
<li><a href="{{ url_for('board.threads') }}">Muro</a></li>
<li>
<a href="{{ url_for('messages.inbox') }}">Privados{% set unread = unread_private() %}{% if unread %} <span class="tag">{{ unread }}</span>{% endif %}</a>
</li>
<li>
{# The badge counts what is waiting for a moderator, so for
anybody else the function returns 0 and nothing is drawn. #}
<a href="{{ url_for('submissions.index') }}">Publicaciones{% set waiting = pending_review() %}{% if waiting %} <span class="tag">{{ waiting }}</span>{% endif %}</a>
</li>
{% if g.member.role in ('owner', 'admin') %}
<li><a href="{{ url_for('home.gestion') }}">Gestión</a></li>
{% endif %}
</ul>
</nav>
{% endif %}
</header>
<div class="page-shell">
<main class="feed">
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<p class="flash flash--{{ category }}">{{ message }}</p>
{% endfor %}
{% endwith %}
{% block main %}{% endblock %}
</main>
<footer class="site-foot">
<a href="/">Ir al sitio público</a>
{% if g.member %} · <a href="{{ url_for('members.index') }}">Miembros</a>{% endif %}
<div class="site-foot__legal">Viena Latina © {{ current_year }} · Área privada</div>
</footer>
</div>
</body>
</html>