mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-10 23:17:37 +01:00
Don't allow users to recreate removed packages
This commit is contained in:
parent
f986caf18b
commit
7558346071
@ -260,13 +260,14 @@ def handle_create_edit(package: typing.Optional[Package], form: PackageForm, aut
|
|||||||
package = Package.query.filter_by(name=form["name"].data, author_id=author.id).first()
|
package = Package.query.filter_by(name=form["name"].data, author_id=author.id).first()
|
||||||
if package is not None:
|
if package is not None:
|
||||||
if package.state == PackageState.DELETED:
|
if package.state == PackageState.DELETED:
|
||||||
package.review_thread_id = None
|
flash(
|
||||||
db.session.delete(package)
|
gettext("Package already exists, but is removed. Please contact ContentDB staff to restore the package"),
|
||||||
|
"danger")
|
||||||
else:
|
else:
|
||||||
flash(Markup(
|
flash(Markup(
|
||||||
f"<a class='btn btn-sm btn-danger float-right' href='{package.getURL('packages.view')}'>View</a>" +
|
f"<a class='btn btn-sm btn-danger float-right' href='{package.getURL('packages.view')}'>View</a>" +
|
||||||
gettext("Package already exists")), "danger")
|
gettext("Package already exists")), "danger")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
package = Package()
|
package = Package()
|
||||||
package.author = author
|
package.author = author
|
||||||
|
Loading…
Reference in New Issue
Block a user