paginate reported/comments

pull/146/head
Aevann 2023-05-05 08:26:53 +03:00
parent d9aeb1f111
commit 75c9c69bf7
1 changed files with 8 additions and 11 deletions

View File

@ -321,7 +321,6 @@ def image_posts_listing(v):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@admin_level_required(PERMS['POST_COMMENT_MODERATION'])
def reported_posts(v):
page = get_page()
listing = g.db.query(Submission).options(load_only(Submission.id)).filter_by(
@ -345,20 +344,18 @@ def reported_posts(v):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@admin_level_required(PERMS['POST_COMMENT_MODERATION'])
def reported_comments(v):
page = get_page()
listing = g.db.query(Comment
).filter_by(
is_approved=None,
is_banned=False,
deleted_utc=0
).join(Comment.flags).order_by(Comment.id.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE+1).all()
listing = g.db.query(Comment).options(load_only(Comment.id)).filter_by(
is_approved=None,
is_banned=False,
deleted_utc=0
).join(Comment.flags)
next_exists = listing.count()
listing = listing.order_by(Comment.id.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE)
listing = [c.id for c in listing]
next_exists = len(listing) > PAGE_SIZE
listing = listing[:PAGE_SIZE]
listing = get_comments(listing, v=v)
return render_template("admin/reported_comments.html",