fix(python): don't show maintainer link for non logged in users

Show a plain maintainer text for non logged in users like the submitted,
last packager.

Closes #373
This commit is contained in:
Jelle van der Waa 2022-08-02 16:30:45 +02:00 committed by Jelle van der Waa
parent 9648628a2c
commit 0e82916b0a
2 changed files with 7 additions and 4 deletions

View file

@ -108,7 +108,7 @@
<tr class="pkgmaint">
<th>{{ "Maintainer" | tr }}:</th>
<td>
{% if pkgbase.Maintainer %}
{% if request.user.is_authenticated() and pkgbase.Maintainer %}
<a href="/account/{{ pkgbase.Maintainer.Username }}">
{{ pkgbase.Maintainer.Username }}
</a>
@ -118,6 +118,9 @@
{% endif %}
{% else %}
{{ pkgbase.Maintainer.Username | default("None" | tr) }}
{% if comaintainers %}
({{ comaintainers|join(', ') }})
{% endif %}
{% endif %}
</td>
</tr>

View file

@ -272,9 +272,9 @@ def test_pkgbase_maintainer(client: TestClient, user: User, maintainer: User,
root = parse_root(resp.text)
maint = root.xpath('//table[@id="pkginfo"]/tr[@class="pkgmaint"]/td')[0]
maint, comaint = maint.xpath('./a')
assert maint.text.strip() == maintainer.Username
assert comaint.text.strip() == user.Username
maint, comaint = maint.text.strip().split()
assert maint == maintainer.Username
assert comaint == f'({user.Username})'
def test_pkgbase_voters(client: TestClient, tu_user: User, package: Package):