fdfdsxcvx

master
Aevann1 2021-11-16 05:04:36 +02:00
parent 12210e92d9
commit 4f8a973b96
1 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,17 @@ from files.helpers.discord import add_role
SITE_NAME = environ.get("SITE_NAME", "").strip()
@app.get("/admin/delete")
@admin_level_required(3)
def delete(v):
shadowbanned = [x[0] for x in g.db.query(User.id).filter(User.shadowbanned != None).all()]
votes = g.db.query(Vote).join(Submission, Vote.submission_id==Submission.id).filter(Submission.author_id.in_(shadowbanned)).all()
votes2 = g.db.query(CommentVote).join(Comment, CommentVote.comment_id==Comment.id).filter(Comment.author_id.in_(shadowbanned)).all()
votes = votes + votes2
for vote in votes: g.db.delete(vote)
g.db.commit()
return (str(len(votes)))
@app.get("/name/<id>/<name>")
@admin_level_required(2)