remotes/1693045480750635534/spooky-22
Aevann1 2021-09-10 07:41:56 +02:00
parent b045fdda36
commit 97602933d9
1 changed files with 12 additions and 3 deletions

View File

@ -28,10 +28,19 @@ IMGUR_KEY = environ.get("IMGUR_KEY", "").strip()
def revert_actions(v, username):
user = get_user(username)
if not user: abort(404)
items = g.db.query(Submission).options(lazyload('*')).all()
print(items)
return {"message": "User has been made admin!"}
items = g.db.query(Submission).options(lazyload('*')).filter_by(removed_by=user.id).all() + g.db.query(Comment).options(lazyload('*')).filter_by(removed_by=user.id).all()
for item in items:
item.is_banned = False
item.removed_by = None
g.db.add(item)
users = g.db.query(Submission).options(lazyload('*')).filter_by(is_banned=user.id).all()
for user in users:
user.unban()
return {"message": "Admin actions reverted!"}
@app.post("/@<username>/make_admin")
@admin_level_required(6)