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
95 lines
4.0 KiB
HTML
95 lines
4.0 KiB
HTML
{% extends "base.html" %}
|
|
{% from "_person.html" import person %}
|
|
{% from "_reaction.html" import reaction %}
|
|
{% from "_attachments.html" import attachments %}
|
|
{% from "_pin.html" import pin %}
|
|
{% block title %}{{ thread.title }}{% endblock %}
|
|
|
|
{% block main %}
|
|
<article class="card">
|
|
<div class="card__meta">
|
|
{% if thread.pinned %}<span class="tag">Fijado</span>{% endif %}
|
|
{% if thread.locked %}<span class="tag tag--quiet">Cerrado</span>{% endif %}
|
|
{% if thread.ai_generated %}<span class="tag tag--ai" title="Quien lo publicó marcó este texto como generado con inteligencia artificial.">Generado con IA</span>{% endif %}
|
|
<span>{{ person(author.display_name, author.gitea_login) }}</span> · <time>{{ thread.created_at }}</time>
|
|
{% if thread.edited_at %}<span class="muted small">(editado)</span>{% endif %}
|
|
</div>
|
|
<h1 class="card__title">{{ thread.title }}</h1>
|
|
<div class="prose">{{ body_html }}</div>
|
|
{{ attachments(thread_images) }}
|
|
|
|
<div class="actions">
|
|
{{ reaction('thread', thread.id, reactions.get(thread.id),
|
|
url_for('board.thread', thread_id=thread.id)) }}
|
|
{% if may_edit(thread) %}
|
|
<a class="linkish" href="{{ url_for('board.edit_thread', thread_id=thread.id) }}">Editar</a>
|
|
{% endif %}
|
|
{% if may_delete(thread) %}
|
|
<form method="post" action="{{ url_for('board.delete_thread', thread_id=thread.id) }}"
|
|
data-confirm="¿Eliminar este tema?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish linkish--danger" type="submit">Eliminar</button>
|
|
</form>
|
|
{% endif %}
|
|
{# Pinning is curation and a moderator does it; closing a conversation
|
|
stops named people talking to each other and is an admin's. #}
|
|
{% if may_pin %}
|
|
{{ pin(thread, url_for('board.thread', thread_id=thread.id)) }}
|
|
{% endif %}
|
|
{% if is_admin %}
|
|
<form method="post" action="{{ url_for('board.set_state', thread_id=thread.id) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<input type="hidden" name="field" value="locked">
|
|
<input type="hidden" name="value" value="{{ 0 if thread.locked else 1 }}">
|
|
<button class="linkish" type="submit">{{ 'Reabrir' if thread.locked else 'Cerrar' }}</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</article>
|
|
|
|
<h2 class="section-head">{{ comments|length }} respuesta{{ '' if comments|length == 1 else 's' }}</h2>
|
|
|
|
{% for c in comments %}
|
|
<article class="card card--comment" id="c{{ c.id }}">
|
|
<div class="card__meta">
|
|
<span>{{ person(c.author, c.author_login) }}</span> · <time>{{ c.created_at }}</time>
|
|
{% if c.edited_at %}<span class="muted small">(editado)</span>{% endif %}
|
|
</div>
|
|
<div class="prose">{{ to_html(c.body_md) }}</div>
|
|
{{ attachments(comment_images.get(c.id, [])) }}
|
|
<div class="actions">
|
|
{{ reaction('comment', c.id, comment_reactions.get(c.id),
|
|
url_for('board.thread', thread_id=thread.id) ~ '#c' ~ c.id) }}
|
|
{% if may_edit(c) %}
|
|
<a class="linkish" href="{{ url_for('board.edit_comment', comment_id=c.id) }}">Editar</a>
|
|
{% endif %}
|
|
{% if may_delete(c) %}
|
|
<form method="post" action="{{ url_for('board.delete_comment', comment_id=c.id) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish linkish--danger" type="submit">Eliminar</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</article>
|
|
{% endfor %}
|
|
|
|
<span id="final"></span>
|
|
|
|
{% if thread.locked and not is_admin %}
|
|
<p class="muted">Este tema está cerrado a nuevas respuestas.</p>
|
|
{% else %}
|
|
<form class="card" method="post" enctype="multipart/form-data"
|
|
action="{{ url_for('board.comment', thread_id=thread.id) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<label for="body">Responder</label>
|
|
<textarea id="body" data-markdown name="body" rows="5" required
|
|
placeholder="Se puede usar Markdown: **negrita**, listas, enlaces."></textarea>
|
|
|
|
<label for="pictures">Imágenes <span class="muted small">(opcional)</span></label>
|
|
<input id="pictures" name="pictures" type="file" multiple accept="image/*">
|
|
|
|
<button class="btn" type="submit">Publicar respuesta</button>
|
|
</form>
|
|
{% endif %}
|
|
{% endblock %}
|