Remove old restore method

This commit is contained in:
rubenwardy 2023-05-12 01:06:09 +01:00
parent e88ead392b
commit 7df1b8cc0f
2 changed files with 2 additions and 39 deletions

@ -30,17 +30,7 @@ from ...models import UserRank, Package, db, PackageState, User, AuditSeverity,
def admin_page(): def admin_page():
if request.method == "POST": if request.method == "POST":
action = request.form["action"] action = request.form["action"]
if action in actions:
if action == "restore":
package = Package.query.get(request.form["package"])
if package is None:
flash("Unknown package", "danger")
else:
package.state = PackageState.READY_FOR_REVIEW
db.session.commit()
return redirect(url_for("admin.admin_page"))
elif action in actions:
ret = actions[action]["func"]() ret = actions[action]["func"]()
if ret: if ret:
return ret return ret

@ -9,6 +9,7 @@
<div class="col-md-6"> <div class="col-md-6">
<div class="list-group"> <div class="list-group">
<a class="list-group-item list-group-item-action" href="{{ url_for('users.list_all') }}">User list</a> <a class="list-group-item list-group-item-action" href="{{ url_for('users.list_all') }}">User list</a>
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.restore') }}">Restore package</a>
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.tag_list') }}">Tag Editor</a> <a class="list-group-item list-group-item-action" href="{{ url_for('admin.tag_list') }}">Tag Editor</a>
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.license_list') }}">License Editor</a> <a class="list-group-item list-group-item-action" href="{{ url_for('admin.license_list') }}">License Editor</a>
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.version_list') }}">Version Editor</a> <a class="list-group-item list-group-item-action" href="{{ url_for('admin.version_list') }}">Version Editor</a>
@ -37,34 +38,6 @@
</div> </div>
</form> </form>
</div> </div>
<div class="card">
<h2 class="card-header">Restore Package</h2>
<form method="post" action="" class="card-body">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="hidden" name="action" value="restore" />
<div class="row px-3">
<select name="package" class="custom-select col">
{% for p in deleted_packages %}
<option value={{ p.id }}>{{ p.id}}) {{ p.title }} by {{ p.author.display_name }}</option>
{% endfor %}
</select>
<input type="submit" value="Restore" class="col-sm-auto btn btn-primary ml-2" />
</div>
</form>
<form method="post" action="" class="card-body">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="hidden" name="action" value="delremovedpackages" />
<p>
{{ _("Deletion is permanent.") }}
</p>
<input type="submit" value="Delete Removed Packages" class="btn btn-danger" />
</form>
</div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}