Fix being able to see unpublished packages

This commit is contained in:
rubenwardy
2023-01-01 20:39:20 +00:00
parent 01344256a9
commit 8ef737b16c
2 changed files with 47 additions and 0 deletions

View File

@@ -116,6 +116,12 @@ def getReleases(package):
@bp.route("/packages/<author>/<name>/")
@is_package_page
def view(package):
if package.state != PackageState.APPROVED and not package.checkPerm(current_user, Permission.EDIT_PACKAGE):
if package.state == PackageState.WIP:
abort(404)
return render_template("packages/gone.html", package=package), 503
show_similar = not package.approved and (
current_user in package.maintainers or
package.checkPerm(current_user, Permission.APPROVE_NEW))