Revert "Add ability to delete threads"

This reverts commit 15821fe796.
This commit is contained in:
rubenwardy
2020-12-04 01:18:02 +00:00
parent 15063d92cd
commit 78630b3071
4 changed files with 19 additions and 65 deletions

View File

@@ -21,7 +21,10 @@ bp = Blueprint("threads", __name__)
from flask_user import *
from app.models import *
from app.utils import addNotification, isYes, addAuditLog
from app.utils import addNotification, clearNotifications, isYes, addAuditLog
import datetime
from flask_wtf import FlaskForm
from wtforms import *
from wtforms.validators import *
@@ -104,29 +107,6 @@ def set_lock(id):
return redirect(thread.getViewURL())
@bp.route("/threads/<int:id>/delete/", methods=["GET", "POST"])
@login_required
def delete_thread(id):
thread = Thread.query.get(id)
if thread is None or not thread.checkPerm(current_user, Permission.DELETE_THREAD):
abort(404)
if request.method == "GET":
return render_template("threads/delete_thread.html", thread=thread)
summary = "\n\n".join([("<{}> {}".format(reply.author.display_name, reply.comment)) for reply in thread.replies])
msg = "Deleted thread {} by {}".format(thread.title, thread.author.display_name)
db.session.delete(thread)
addAuditLog(AuditSeverity.MODERATION, current_user, msg, None, thread.package, summary)
db.session.commit()
return redirect(url_for("homepage.home"))
@bp.route("/threads/<int:id>/delete/", methods=["GET", "POST"])
@login_required
def delete_reply(id):