Two bugs, both mine. The profile page arrived unstyled because its CSS was in a <style> block. default-src 'self' covers style-src, 'self' does not permit inline, so the browser dropped the whole block without a word — the photo loaded because img-src allows same-origin, which is what made the screenshot look like a half-working page rather than a blocked one. The third time this policy has silently made something inert, after two rounds of inline event handlers. Moved to static/profile.css, where the policy allows it, and test_templates.py now fails on an inline <style> the way it already does on an inline onclick. Private messages had an "Abrir conversación" button that created an empty conversation and sent you to a page where you then had to type. It bought nothing and littered the inbox with rows reading "Sin mensajes todavía" for people nobody had written to. A conversation is now addressed by the person — /privados/con/<member_id> — and the page always carries the history and the box together. The row is created by the first message, not by looking at somebody's name. That also makes the access rule structural instead of checked. Every lookup is scoped to the member doing the looking, so there is no query that could return somebody else's correspondence, and the two helpers that took a conversation id are gone. A third person opening the same URL now sees their own empty conversation, which the tests assert directly rather than asserting a 404. 281 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
54 lines
1.9 KiB
HTML
54 lines
1.9 KiB
HTML
{% extends "base.html" %}
|
|
{% from "_attachments.html" import attachments %}
|
|
{% block title %}{{ other.display_name }}{% endblock %}
|
|
|
|
{% block main %}
|
|
<div class="feed-head">
|
|
<h1>{{ other.display_name }}</h1>
|
|
<a class="linkish" href="{{ url_for('messages.inbox') }}">Volver</a>
|
|
</div>
|
|
|
|
{% for m in messages %}
|
|
<article class="card card--comment">
|
|
<div class="card__meta">
|
|
<span>{{ m.author }}</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=other.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>
|
|
{% else %}
|
|
{# Always on this page, under the history. There is no separate step to "open"
|
|
a conversation: arriving at somebody's name is opening it, and nothing is
|
|
created in the database until the first message is actually sent. #}
|
|
<form class="card" method="post" enctype="multipart/form-data"
|
|
action="{{ url_for('messages.talk', member_id=other.id) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<label for="body">Mensaje</label>
|
|
<textarea id="body" name="body" rows="4" autofocus
|
|
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>
|
|
{% endif %}
|
|
{% endblock %}
|