mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Fix being able to see unpublished packages
This commit is contained in:
parent
01344256a9
commit
8ef737b16c
@ -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))
|
||||
|
41
app/templates/packages/gone.html
Normal file
41
app/templates/packages/gone.html
Normal file
@ -0,0 +1,41 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{{ package.title }}
|
||||
{% endblock %}
|
||||
|
||||
{% block headextra %}
|
||||
<meta name="og:title" content="{{ package.title }}"/>
|
||||
<meta name="og:description" content="{{ package.short_desc }}"/>
|
||||
<meta name="description" content="{{ package.short_desc }}"/>
|
||||
<meta name="og:url" content="{{ package.getURL("packages.view", absolute=True) }}"/>
|
||||
{% if package.getThumbnailURL(3, True) %}
|
||||
<meta name="og:image" content="{{ package.getThumbnailURL(3, True) }}"/>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if package.approved_at %}
|
||||
<h1>{{ _("Package Removed") }}</h1>
|
||||
<p>
|
||||
{{ _("This package has been unpublished.") }}
|
||||
{{ _("It may have been removed by choice of the author, or by ContentDB staff due to a problem.") }}
|
||||
</p>
|
||||
{% elif package.state.name == "READY_FOR_REVIEW" %}
|
||||
<h1>{{ _("Package Undergoing Review") }}</h1>
|
||||
<p>
|
||||
{{ _("This package is currently undergoing review") }}
|
||||
</p>
|
||||
{% else %}
|
||||
<h1>{{ _("Package Undergoing Review") }}</h1>
|
||||
<p>
|
||||
{{ _("This package is currently undergoing review, and changes are needed before it can be added.") }}
|
||||
</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
{{ _("Please check back again later.") }}
|
||||
</p>
|
||||
<p>
|
||||
<a href="{{ url_for('users.login') }}" class="btn btn-primary">{{ _("Login") }}</a>
|
||||
</p>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user