The second half of the superadministrator's job: not just who may do things, but
what they get to do that nobody else does.
**Identidad** is everything that used to be frozen in config.yaml — the name and
the one-line tagline in all three languages, the association's accounts
elsewhere, a public email, a city and street, a share picture and the footer
line. It commits data/site.yaml the way Marca commits data/brand.yaml.
Hugo cannot have config.yaml overridden by a data file, so the name and tagline
are read through two new partials that prefer the data file and fall back to the
config; every template showing either calls one, so they cannot drift. A site
with no data/site.yaml builds byte-for-byte what it built before — asserted by
building both ways and diffing with the stylesheet fingerprint normalised.
The contact fields are not decoration: they become ContactPoint and
PostalAddress in the Organization schema, which is what puts an association in a
local result rather than only a web one, and the social links become sameAs,
which is how an engine knows an Instagram account and this site are one body.
**Marca** grows a typeface and a roundness. Four system stacks — nothing
downloaded, which is deliberate and a GDPR matter — or an uploaded .woff2,
sniffed by its wOF2 signature, capped at 400 KB, named ahead of the old stack so
a font that fails to load leaves a readable site. The fold-out warning covers
missing accented glyphs, file size, synthesised bold, and licensing: a font is
software, a desktop licence is not a webfont licence, and that liability follows
the platform to every organisation it is installed for. SIL OFL and Apache-2.0
are named, with seven places to find them.
**Three tools.** Estado del sistema exercises the content token against the
repository rather than checking it is non-empty — "present" was never the
problem, a wrong scope broke publishing for three phases while looking fine —
and reports mail, backups, disk and every documented setting the container does
not have. It changes nothing on purpose. Registro de actividad records the dozen
acts that change who can do what; the actor is cleared and not cascaded on
erasure, and log() never raises, because an administrator who could not be
appointed because the note about it could not be saved is worse than a gap in
the notes. Biblioteca de medios lists every picture with the posts that use it
and, finally, shows the orphans — a picture whose post was deleted has stayed in
the repository, deployed and unreferenced, for the life of this site with no way
to see one.
Two bugs found by looking at the rendered pages rather than at the tests:
**Gestión had disappeared from the superadministrator's own navigation.**
base.html asked `g.member.role in ('owner', 'admin')`, right until a role
appeared above both. 622 tests passed while it was broken, because every one of
them signed in as an admin or below. The templates now call the same
`is_at_least` the handlers do, and test_navigation.py covers the tier above
admin — verified by reintroducing the tuple and watching it fail.
And the status screen counted the tombstone as a suspended member.
Migration 8 is plain ADD COLUMNs; `activity` and `site` are new tables, so
CREATE TABLE IF NOT EXISTS covers them with no step at all. The erase guard
caught both the moment they existed, which is that test doing its job.
627 tests pass. Hugo builds clean with the pipeline's flags, both with and
without the two data files.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
222 lines
9.3 KiB
HTML
222 lines
9.3 KiB
HTML
{# One person's page inside the members area.
|
|
|
|
Three things in one place, in the order somebody actually wants them: who
|
|
this is, what you have said to each other, and — for an admin — what can be
|
|
done about them. It replaces two screens, `conversation.html` and the
|
|
`<details>` block that used to be on every card in the directory.
|
|
|
|
The private half is the reason this page exists and the reason it is behind
|
|
the login. Their *public* page is a separate thing they publish themselves,
|
|
linked below when they have. #}
|
|
{% extends "base.html" %}
|
|
{% from "_person.html" import person %}
|
|
{% from "_attachments.html" import attachments %}
|
|
{% block title %}{{ member.display_name }}{% endblock %}
|
|
|
|
{% set me = g.member %}
|
|
{# The template mirrors the predicates in members.py rather than restating
|
|
them: `can_assign` is the same list the handler will accept, so the picker
|
|
cannot offer a role that comes back 403. #}
|
|
{% set is_super = me.role == 'superadmin' %}
|
|
{% set is_chair = me.role in ('superadmin', 'owner') %}
|
|
{% set is_admin = is_at_least(me.role, 'admin') %}
|
|
{% set can_assign = assignable_roles(me.role) %}
|
|
|
|
{% block main %}
|
|
<div class="feed-head">
|
|
<h1>{{ member.display_name }}{% if is_me %} <span class="muted small">(tú)</span>{% endif %}</h1>
|
|
<a class="linkish" href="{{ url_for('members.index') }}">Todos los miembros</a>
|
|
</div>
|
|
|
|
<section class="card person-head">
|
|
{% if member.photo_name %}
|
|
<img class="person-head__photo"
|
|
src="{{ url_for('profiles.member_photo', stored_name=member.photo_name) }}"
|
|
alt="">
|
|
{% else %}
|
|
<span class="person-head__photo person-head__photo--none" aria-hidden="true">
|
|
{{ member.display_name[:1]|upper }}
|
|
</span>
|
|
{% endif %}
|
|
|
|
<div class="person-head__who">
|
|
<p class="muted small">
|
|
<span class="mono">{{ member.gitea_login }}</span> · {{ labels[member.role] }}
|
|
{% if not member.active %} · Suspendido{% endif %}
|
|
</p>
|
|
|
|
{% if member.bio %}<div class="prose">{{ bio_html }}</div>{% endif %}
|
|
|
|
{% if links %}
|
|
<ul class="person-head__links">
|
|
{% for link in links %}
|
|
{# nofollow noopener as on the public page: these are addresses a
|
|
member typed, and this page is no safer a place to vouch for them. #}
|
|
<li><a href="{{ link.url }}" rel="nofollow noopener">{{ link.label or link.url }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
<p class="person-head__foot">
|
|
{% if member.profile_published %}
|
|
<a class="linkish" href="{{ url_for('profiles_public.show', name=member.gitea_login) }}">Su página pública</a>
|
|
{% elif is_me %}
|
|
<a class="linkish" href="{{ url_for('profiles.edit') }}">Editar mi perfil</a>
|
|
{% else %}
|
|
<span class="muted small">No ha publicado una página pública.</span>
|
|
{% endif %}
|
|
</p>
|
|
</div>
|
|
</section>
|
|
|
|
{% if is_me %}
|
|
{# No conversation with yourself, and nothing to mark read. Your own private
|
|
messages are each on the page of the person you had them with, which is the
|
|
whole arrangement. #}
|
|
<p class="muted">
|
|
Esta es tu ficha, tal como la ven los demás. Para escribir a alguien, abre su
|
|
ficha desde <a href="{{ url_for('members.index') }}">Miembros</a>.
|
|
</p>
|
|
{% else %}
|
|
|
|
<h2 class="section-title">Conversación privada</h2>
|
|
<p class="muted small">
|
|
Sólo vosotros dos podéis leer esto.
|
|
</p>
|
|
|
|
{% for m in messages %}
|
|
<article class="card card--comment">
|
|
<div class="card__meta">
|
|
<span>{{ person(m.author, m.author_login) }}</span> · <time>{{ m.created_at }}</time>
|
|
</div>
|
|
<div class="prose">{{ to_html(m.body_md) }}</div>
|
|
{{ attachments(images.get(m.id, [])) }}
|
|
</article>
|
|
{% else %}
|
|
<p class="muted">Todavía no os habéis escrito. Empieza abajo.</p>
|
|
{% endfor %}
|
|
|
|
<span id="final"></span>
|
|
|
|
{% if blocked %}
|
|
<p class="muted">
|
|
Hay un bloqueo entre vosotros, así que ninguno de los dos puede escribir.
|
|
</p>
|
|
<form method="post" action="{{ url_for('messages.unblock', member_id=member.id) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish" type="submit">Quitar mi bloqueo</button>
|
|
</form>
|
|
<p class="muted small">
|
|
Si el bloqueo lo puso la otra persona, esto no lo quita.
|
|
</p>
|
|
{% elif not member.active %}
|
|
{# The handler refuses a message to a suspended member, so the box is not drawn
|
|
for one. Said plainly rather than left as a missing form. #}
|
|
<p class="muted">
|
|
{{ member.display_name }} tiene el acceso suspendido y no puede recibir mensajes.
|
|
</p>
|
|
{% else %}
|
|
<form class="card" method="post" enctype="multipart/form-data"
|
|
action="{{ url_for('messages.talk', member_id=member.id) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<label for="body">Mensaje</label>
|
|
<textarea id="body" data-markdown name="body" rows="4"
|
|
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">Enviar</button>
|
|
</form>
|
|
|
|
<details class="person-block">
|
|
<summary>Bloquear a {{ member.display_name }}</summary>
|
|
<p class="muted small">
|
|
Un bloqueo va en los dos sentidos: ninguno de los dos podrá escribir al
|
|
otro. Lo puedes quitar cuando quieras, pero sólo el tuyo.
|
|
</p>
|
|
<form method="post" action="{{ url_for('messages.block', member_id=member.id) }}"
|
|
data-confirm="Ninguno de los dos podrá escribir al otro. ¿Seguro?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish linkish--danger" type="submit">Bloquear</button>
|
|
</form>
|
|
</details>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if is_admin and member.role not in ('superadmin', 'owner') and not is_me %}
|
|
{# Moved here from the directory cards. A <details>, not a script: the CSP has
|
|
no 'unsafe-inline'. Every button is still checked in its handler — this block
|
|
being hidden from a moderator is a courtesy, not the rule. #}
|
|
<details class="person-card__admin">
|
|
<summary>Gestionar</summary>
|
|
<div class="person-card__actions">
|
|
<form method="post" action="{{ url_for('members.set_active', member_id=member.id) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<input type="hidden" name="active" value="{{ 0 if member.active else 1 }}">
|
|
<button class="linkish" type="submit">{{ 'Suspender' if member.active else 'Reactivar' }}</button>
|
|
</form>
|
|
|
|
{# Any admin can re-send, not just the owner: the usual reason somebody
|
|
needs this is that the admin who added them made the account by hand,
|
|
and waiting for the owner defeats the point. Hidden without an
|
|
address, because the handler would refuse. #}
|
|
{% if member.email and member.active %}
|
|
<form method="post" action="{{ url_for('members.invite', member_id=member.id) }}"
|
|
data-confirm="Se enviará un enlace nuevo a {{ member.email }} y el anterior dejará de servir. ¿Seguro?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish" type="submit">Enviar invitación</button>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% if member.role in can_assign or member.role not in ('admin',) %}
|
|
<form class="inline-form" method="post"
|
|
action="{{ url_for('members.set_role', member_id=member.id) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<label class="sr-only" for="role">Rol de {{ member.display_name }}</label>
|
|
<select id="role" name="role">
|
|
{% for role in can_assign %}
|
|
<option value="{{ role }}" {{ 'selected' if member.role == role }}>{{ labels[role] }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<button class="linkish" type="submit">Cambiar rol</button>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% if is_chair and member.active %}
|
|
{# Naming the responsable: the association's chair. The superadministrator
|
|
can fill it when it is empty — a fresh install has nobody in it — and
|
|
the responsable can hand it on. #}
|
|
<form method="post" action="{{ url_for('members.transfer', member_id=member.id) }}"
|
|
data-confirm="{{ member.display_name }} pasará a ser el responsable de la asociación. ¿Seguro?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish" type="submit">Nombrar responsable</button>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% if is_super and member.role == 'admin' and member.active %}
|
|
{# Handing the platform on. Its own button, and its own sentence, because
|
|
it is irreversible from this side: the moment it commits you are an
|
|
administrator and cannot take it back. #}
|
|
<form method="post" action="{{ url_for('members.transfer_platform', member_id=member.id) }}"
|
|
data-confirm="{{ member.display_name }} pasará a ser el superadministrador y tú pasarás a ser administrador. No podrás deshacerlo tú mismo. ¿Seguro?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish linkish--danger" type="submit">Entregar la plataforma</button>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% if is_chair %}
|
|
<form method="post" action="{{ url_for('members.erase', member_id=member.id) }}"
|
|
data-confirm="Se borrarán sus datos personales. Sus mensajes quedarán como «Miembro eliminado». ¿Seguro?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish linkish--danger" type="submit">Eliminar</button>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% if member.email %}<p class="muted small">{{ member.email }}</p>{% endif %}
|
|
{% if member.creator %}<p class="muted small">Dado de alta por {{ member.creator }}.</p>{% endif %}
|
|
</div>
|
|
</details>
|
|
{% endif %}
|
|
{% endblock %}
|