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
87 lines
3.0 KiB
HTML
87 lines
3.0 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Publicaciones{% endblock %}
|
|
|
|
{% block main %}
|
|
<div class="feed-head">
|
|
<h1>Publicaciones</h1>
|
|
{% if can_moderate %}
|
|
<a class="btn" href="{{ url_for('content.new', collection='post') }}">Publicar</a>
|
|
{% else %}
|
|
<a class="btn" href="{{ url_for('submissions.propose') }}">Proponer</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<p class="muted">
|
|
{% if can_moderate %}
|
|
Lo que publicas aquí sale al sitio en cuanto lo guardas. Lo que proponen los
|
|
miembros espera en esta cola hasta que tú u otro moderador lo apruebe.
|
|
<a href="{{ url_for('content.index') }}">Ver lo ya publicado</a>.
|
|
{% else %}
|
|
Esto va a vienalatina.com, donde lo lee cualquiera. Un moderador lo lee
|
|
primero: si hace falta cambiar algo te lo devuelve con el motivo.
|
|
{% endif %}
|
|
</p>
|
|
|
|
{% if can_moderate %}
|
|
<h2 class="section-head">Esperando revisión</h2>
|
|
{% if not queue %}
|
|
<article class="card"><p class="muted">Nada pendiente. La cola está vacía.</p></article>
|
|
{% endif %}
|
|
{% for item in queue %}
|
|
<article class="card">
|
|
<div class="card__meta">
|
|
<span>{{ item.author }}</span> · <time>{{ item.created_at }}</time>
|
|
</div>
|
|
<h3 class="card__title">
|
|
<a href="{{ url_for('submissions.show', submission_id=item.id) }}">{{ item.title }}</a>
|
|
</h3>
|
|
<p class="card__excerpt">{{ excerpt(item.body_md) }}</p>
|
|
<div class="card__foot actions actions--row">
|
|
<a class="linkish" href="{{ url_for('submissions.show', submission_id=item.id) }}">Leer y revisar</a>
|
|
</div>
|
|
</article>
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
<h2 class="section-head">Lo que he propuesto</h2>
|
|
{% if not mine %}
|
|
<article class="card">
|
|
<p class="muted">
|
|
{% if can_moderate %}
|
|
Nada. Tus publicaciones no pasan por aquí: van directas al sitio.
|
|
{% else %}
|
|
Todavía no has propuesto nada.
|
|
{% endif %}
|
|
</p>
|
|
</article>
|
|
{% endif %}
|
|
{% for item in mine %}
|
|
<article class="card">
|
|
<div class="card__meta">
|
|
<span class="tag tag--{{ item.state }}">{{ labels[item.state] }}</span>
|
|
<time>{{ item.created_at }}</time>
|
|
</div>
|
|
<h3 class="card__title">
|
|
<a href="{{ url_for('submissions.show', submission_id=item.id) }}">{{ item.title }}</a>
|
|
</h3>
|
|
{% if item.state == 'rejected' and item.note %}
|
|
{# The reason, on the list rather than one click away: it is the only thing
|
|
the author needs in order to know what to do next. #}
|
|
<p class="card__excerpt"><strong>Motivo:</strong> {{ item.note }}</p>
|
|
{% endif %}
|
|
<div class="card__foot actions actions--row">
|
|
{% if item.state != 'approved' %}
|
|
<a class="linkish" href="{{ url_for('submissions.edit', submission_id=item.id) }}">Editar</a>
|
|
<form method="post" action="{{ url_for('submissions.withdraw', submission_id=item.id) }}"
|
|
data-confirm="Se borrará la propuesta «{{ item.title }}». ¿Seguro?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish linkish--danger" type="submit">Retirar</button>
|
|
</form>
|
|
{% elif item.published_path %}
|
|
<span class="muted small">Publicado en {{ item.published_path }}</span>
|
|
{% endif %}
|
|
</div>
|
|
</article>
|
|
{% endfor %}
|
|
{% endblock %}
|