mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-31 18:27:30 +01:00
Add reason to package removal
This commit is contained in:
parent
db14b3f4ef
commit
34ccd76b0c
@ -408,6 +408,8 @@ def remove(package):
|
||||
return render_template("packages/remove.html", package=package,
|
||||
tabs=get_package_tabs(current_user, package), current_tab="remove")
|
||||
|
||||
reason = request.form.get("reason") or "?"
|
||||
|
||||
if "delete" in request.form:
|
||||
if not package.checkPerm(current_user, Permission.DELETE_PACKAGE):
|
||||
flash(gettext("You don't have permission to do that."), "danger")
|
||||
@ -416,7 +418,7 @@ def remove(package):
|
||||
package.state = PackageState.DELETED
|
||||
|
||||
url = url_for("users.profile", username=package.author.username)
|
||||
msg = "Deleted {}".format(package.title)
|
||||
msg = "Deleted {}, reason={}".format(package.title, reason)
|
||||
addNotification(package.maintainers, current_user, NotificationType.PACKAGE_EDIT, msg, url, package)
|
||||
addAuditLog(AuditSeverity.EDITOR, current_user, msg, url)
|
||||
db.session.commit()
|
||||
@ -431,7 +433,7 @@ def remove(package):
|
||||
|
||||
package.state = PackageState.WIP
|
||||
|
||||
msg = "Unapproved {}".format(package.title)
|
||||
msg = "Unapproved {}, reason={}".format(package.title, reason)
|
||||
addNotification(package.maintainers, current_user, NotificationType.PACKAGE_APPROVAL, msg, package.getURL("packages.view"), package)
|
||||
addAuditLog(AuditSeverity.EDITOR, current_user, msg, package.getURL("packages.view"), package)
|
||||
|
||||
|
@ -23,6 +23,11 @@ Remove {{ package.title }}
|
||||
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="reason">Reason</label>
|
||||
<input id="reason" class="form-control" type="text" name="reason" required minlength="5">
|
||||
</div>
|
||||
|
||||
<a class="btn btn-secondary float-right" href="{{ package.getURL("packages.view") }}">{{ _("Cancel") }}</a>
|
||||
|
||||
<input type="submit" name="delete" value="Remove" class="btn btn-danger mr-2" />
|
||||
|
Loading…
Reference in New Issue
Block a user