fix(templates): require valid User relationships for <a> usage

Previously, when the relationship was None, an <a> would still
wrap the None value erroneously. This addresses that for all
three user fields.

In addition, this commit adds direct testing for the
`templates/partials/packages/details.html` template.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-12-31 01:02:40 -08:00
parent 278490e103
commit 53fabdfaea
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
2 changed files with 230 additions and 8 deletions

View file

@ -96,9 +96,9 @@
<tr>
<th>{{ "Submitter" | tr }}:</th>
<td>
{% if request.user.is_authenticated() %}
{% if request.user.is_authenticated() and pkgbase.Submitter %}
<a href="/account/{{ pkgbase.Submitter.Username }}">
{{ pkgbase.Submitter.Username | default("None" | tr) }}
{{ pkgbase.Submitter.Username }}
</a>
{% else %}
{{ pkgbase.Submitter.Username | default("None" | tr) }}
@ -108,9 +108,9 @@
<tr>
<th>{{ "Maintainer" | tr }}:</th>
<td>
{% if request.user.is_authenticated() %}
{% if request.user.is_authenticated() and pkgbase.Maintainer %}
<a href="/account/{{ pkgbase.Maintainer.Username }}">
{{ pkgbase.Maintainer.Username | default("None" | tr) }}
{{ pkgbase.Maintainer.Username }}
</a>
{% else %}
{{ pkgbase.Maintainer.Username | default("None" | tr) }}
@ -120,9 +120,9 @@
<tr>
<th>{{ "Last Packager" | tr }}:</th>
<td>
{% if request.user.is_authenticated() %}
{% if request.user.is_authenticated() and pkgbase.Packager %}
<a href="/account/{{ pkgbase.Packager.Username }}">
{{ pkgbase.Packager.Username | default("None" | tr) }}
{{ pkgbase.Packager.Username }}
</a>
{% else %}
{{ pkgbase.Packager.Username | default("None" | tr) }}