diff --git a/app/blueprints/packages/packages.py b/app/blueprints/packages/packages.py index ba2d7a49..dbace6d7 100644 --- a/app/blueprints/packages/packages.py +++ b/app/blueprints/packages/packages.py @@ -116,6 +116,12 @@ def getReleases(package): @bp.route("/packages///") @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)) diff --git a/app/templates/packages/gone.html b/app/templates/packages/gone.html new file mode 100644 index 00000000..6a0f6dd1 --- /dev/null +++ b/app/templates/packages/gone.html @@ -0,0 +1,41 @@ +{% extends "base.html" %} + +{% block title %} + {{ package.title }} +{% endblock %} + +{% block headextra %} + + + + + {% if package.getThumbnailURL(3, True) %} + + {% endif %} +{% endblock %} + +{% block content %} + {% if package.approved_at %} +

{{ _("Package Removed") }}

+

+ {{ _("This package has been unpublished.") }} + {{ _("It may have been removed by choice of the author, or by ContentDB staff due to a problem.") }} +

+ {% elif package.state.name == "READY_FOR_REVIEW" %} +

{{ _("Package Undergoing Review") }}

+

+ {{ _("This package is currently undergoing review") }} +

+ {% else %} +

{{ _("Package Undergoing Review") }}

+

+ {{ _("This package is currently undergoing review, and changes are needed before it can be added.") }} +

+ {% endif %} +

+ {{ _("Please check back again later.") }} +

+

+ {{ _("Login") }} +

+{% endblock %}