style: Indicate deleted accounts on requests page

Show "(deleted)" on requests page for user accounts that were removed.

Fixes #505

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2024-06-24 16:35:21 +02:00
parent ed878c8c5e
commit 33d31d4117
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
2 changed files with 15 additions and 2 deletions

View file

@ -119,12 +119,15 @@
<td>
{# Filed by #}
{# If the record has an associated User, display a link to that user. #}
{# Otherwise, display nothing (an empty column). #}
{# Otherwise, display "(deleted)". #}
{% if result.User %}
<a href="/account/{{ result.User.Username }}">
{{ result.User.Username }}
</a>&nbsp;
</a>
{% else %}
<i>(deleted)</i>
{% endif %}
&nbsp;
<a target="_blank" rel="noopener noreferrer" href="{{ result.ml_message_url() }}">
(PRQ#{{ result.ID }})
</a>

View file

@ -834,6 +834,16 @@ def test_requests(
rows = root.xpath('//table[@class="results"]/tbody/tr')
assert len(rows) == 5 # There are five records left on the second page.
# Delete requesters user account and check output
with db.begin():
db.delete(requests[0].User)
with client as request:
request.cookies = cookies
resp = request.get("/requests")
assert "(deleted)" in resp.text
def test_requests_with_filters(
client: TestClient,