mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: hide Unflag package from non-maintainers
Closes: #364 Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
This commit is contained in:
parent
0b03a6871e
commit
034e47bc28
3 changed files with 7 additions and 2 deletions
|
@ -38,8 +38,8 @@ def pkgbase_unnotify_instance(request: Request, pkgbase: PackageBase) -> None:
|
|||
|
||||
|
||||
def pkgbase_unflag_instance(request: Request, pkgbase: PackageBase) -> None:
|
||||
has_cred = request.user.has_credential(
|
||||
creds.PKGBASE_UNFLAG, approved=[pkgbase.Flagger, pkgbase.Maintainer])
|
||||
has_cred = request.user.has_credential(creds.PKGBASE_UNFLAG, approved=[
|
||||
pkgbase.Flagger, pkgbase.Maintainer] + [c.User for c in pkgbase.comaintainers])
|
||||
if has_cred:
|
||||
with db.begin():
|
||||
pkgbase.OutOfDateTS = None
|
||||
|
|
|
@ -39,6 +39,9 @@ def make_context(request: Request, pkgbase: PackageBase,
|
|||
PackageComaintainer.Priority.asc()
|
||||
).all()
|
||||
]
|
||||
context["unflaggers"] = context["comaintainers"].copy()
|
||||
context["unflaggers"].append(pkgbase.Maintainer)
|
||||
|
||||
context["packages_count"] = pkgbase.packages.count()
|
||||
context["keywords"] = pkgbase.keywords
|
||||
context["comments"] = pkgbase.comments.order_by(
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
</a>
|
||||
</span>
|
||||
</li>
|
||||
{% if request.user.has_credential(creds.PKGBASE_UNFLAG, approved=unflaggers) %}
|
||||
<li>
|
||||
<form action="/pkgbase/{{ pkgbase.Name }}/unflag" method="post">
|
||||
<input class="button text-button"
|
||||
|
@ -51,6 +52,7 @@
|
|||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<li>
|
||||
{% if not voted %}
|
||||
<form action="/pkgbase/{{ pkgbase.Name }}/vote" method="post">
|
||||
|
|
Loading…
Add table
Reference in a new issue