mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(package/pkgbase view): include comaintainers in Maintainer field
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
2c4f4155d6
commit
62388b4161
3 changed files with 32 additions and 1 deletions
|
@ -25,6 +25,9 @@ def make_context(request: Request, pkgbase: PackageBase) -> Dict[str, Any]:
|
||||||
context["git_clone_uri_anon"] = config.get("options", "git_clone_uri_anon")
|
context["git_clone_uri_anon"] = config.get("options", "git_clone_uri_anon")
|
||||||
context["git_clone_uri_priv"] = config.get("options", "git_clone_uri_priv")
|
context["git_clone_uri_priv"] = config.get("options", "git_clone_uri_priv")
|
||||||
context["pkgbase"] = pkgbase
|
context["pkgbase"] = pkgbase
|
||||||
|
context["comaintainers"] = pkgbase.comaintainers.order_by(
|
||||||
|
PackageComaintainer.Priority.asc()
|
||||||
|
).all()
|
||||||
context["packages_count"] = pkgbase.packages.count()
|
context["packages_count"] = pkgbase.packages.count()
|
||||||
context["keywords"] = pkgbase.keywords
|
context["keywords"] = pkgbase.keywords
|
||||||
context["comments"] = pkgbase.comments.order_by(
|
context["comments"] = pkgbase.comments.order_by(
|
||||||
|
|
|
@ -105,13 +105,16 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="pkgmaint">
|
||||||
<th>{{ "Maintainer" | tr }}:</th>
|
<th>{{ "Maintainer" | tr }}:</th>
|
||||||
<td>
|
<td>
|
||||||
{% if pkgbase.Maintainer %}
|
{% if pkgbase.Maintainer %}
|
||||||
<a href="/account/{{ pkgbase.Maintainer.Username }}">
|
<a href="/account/{{ pkgbase.Maintainer.Username }}">
|
||||||
{{ pkgbase.Maintainer.Username }}
|
{{ pkgbase.Maintainer.Username }}
|
||||||
</a>
|
</a>
|
||||||
|
{% if comaintainers %}
|
||||||
|
({% for co in comaintainers %}<a href="{{ co.User | account_url }}">{{ co.User }}</a>{% endfor %})
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ pkgbase.Maintainer.Username | default("None" | tr) }}
|
{{ pkgbase.Maintainer.Username | default("None" | tr) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -253,6 +253,31 @@ def test_pkgbase(client: TestClient, package: Package):
|
||||||
assert pkgs[i].text.strip() == name
|
assert pkgs[i].text.strip() == name
|
||||||
|
|
||||||
|
|
||||||
|
def test_pkgbase_maintainer(client: TestClient, user: User, maintainer: User,
|
||||||
|
package: Package):
|
||||||
|
"""
|
||||||
|
Test that the Maintainer field is beind displayed correctly.
|
||||||
|
|
||||||
|
Co-maintainers are displayed, if they exist, within a parens after
|
||||||
|
the maintainer.
|
||||||
|
"""
|
||||||
|
with db.begin():
|
||||||
|
db.create(PackageComaintainer, User=user,
|
||||||
|
PackageBase=package.PackageBase,
|
||||||
|
Priority=1)
|
||||||
|
|
||||||
|
with client as request:
|
||||||
|
resp = request.get(f"/pkgbase/{package.Name}")
|
||||||
|
assert resp.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
def test_pkgbase_voters(client: TestClient, tu_user: User, package: Package):
|
def test_pkgbase_voters(client: TestClient, tu_user: User, package: Package):
|
||||||
pkgbase = package.PackageBase
|
pkgbase = package.PackageBase
|
||||||
endpoint = f"/pkgbase/{pkgbase.Name}/voters"
|
endpoint = f"/pkgbase/{pkgbase.Name}/voters"
|
||||||
|
|
Loading…
Add table
Reference in a new issue