Use 403 status code for unpublished pages

This commit is contained in:
rubenwardy 2023-01-02 17:20:08 +00:00
parent 34bbb281e0
commit a7bbb45fc2

@ -95,7 +95,7 @@ def list_all():
topics = qb.buildTopicQuery().all() topics = qb.buildTopicQuery().all()
tags_query = db.session.query(func.count(Tags.c.tag_id), Tag) \ tags_query = db.session.query(func.count(Tags.c.tag_id), Tag) \
.select_from(Tag).join(Tags).join(Package).group_by(Tag.id).order_by(db.asc(Tag.title)) .select_from(Tag).join(Tags).join(Package).group_by(Tag.id).order_by(db.asc(Tag.title))
tags = qb.filterPackageQuery(tags_query).all() tags = qb.filterPackageQuery(tags_query).all()
selected_tags = set(qb.tags) selected_tags = set(qb.tags)
@ -117,7 +117,7 @@ def getReleases(package):
@is_package_page @is_package_page
def view(package): def view(package):
if package.state != PackageState.APPROVED and not package.checkPerm(current_user, Permission.EDIT_PACKAGE): if package.state != PackageState.APPROVED and not package.checkPerm(current_user, Permission.EDIT_PACKAGE):
return render_template("packages/gone.html", package=package), 503 return render_template("packages/gone.html", package=package), 403
show_similar = not package.approved and ( show_similar = not package.approved and (
current_user in package.maintainers or current_user in package.maintainers or