This commit is contained in:
Aevann1 2021-12-17 19:55:11 +02:00
parent 1f32f3a35d
commit 2984e15fba
9 changed files with 124 additions and 30 deletions

View file

@ -290,7 +290,7 @@ def reported_posts(v):
posts = g.db.query(Submission).filter_by(
is_approved=0,
is_banned=False
).order_by(Submission.id.desc()).offset(25 * (page - 1)).limit(26)
).join(Submission.reports).order_by(Submission.id.desc()).offset(25 * (page - 1)).limit(26)
listing = [p.id for p in posts]
next_exists = (len(listing) > 25)
@ -312,7 +312,7 @@ def reported_comments(v):
).filter_by(
is_approved=0,
is_banned=False
).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all()
).join(Comment.reports).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all()
listing = [p.id for p in posts]
next_exists = (len(listing) > 25)
@ -559,7 +559,7 @@ def admin_link_accounts(v):
return redirect(f"/admin/alt_votes?u1={g.db.query(User).get(u1).username}&u2={g.db.query(User).get(u2).username}")
@app.get("/admin/removed")
@app.get("/admin/removed/posts")
@admin_level_required(2)
def admin_removed(v):
@ -583,6 +583,29 @@ def admin_removed(v):
)
@app.get("/admin/removed/comments")
@admin_level_required(2)
def admin_removed_comments(v):
page = int(request.values.get("page", 1))
ids = g.db.query(Comment.id).join(User, User.id == Comment.author_id).filter(or_(Comment.is_banned==True, User.shadowbanned != None)).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all()
ids=[x[0] for x in ids]
next_exists = len(ids) > 25
ids = ids[:25]
comments = get_comments(ids, v=v)
return render_template("admin/removed_comments.html",
v=v,
listing=comments,
page=page,
next_exists=next_exists
)
@app.post("/agendaposter/<user_id>")
@admin_level_required(2)