diff --git a/files/routes/front.py b/files/routes/front.py index 55fbb00c3..cf3188b9f 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -213,22 +213,22 @@ def all_comments(v): return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists) - @cache.memoize(timeout=86400) -def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", gt=0, lt=0, site=None): - - comments = g.db.query(Comment.id).filter(Comment.parent_submission != None, Comment.author_id.notin_(v.userblocks)) +def comment_idlist(v=None, page=1, sort="new", t="all", gt=0, lt=0, site=None): + comments = g.db.query(Comment.id) \ + .join(Comment.post) \ + .filter(Comment.parent_submission != None) if v.admin_level < PERMS['POST_COMMENT_MODERATION']: - private = [x[0] for x in g.db.query(Submission.id).filter(Submission.private == True).all()] - - comments = comments.filter(Comment.is_banned==False, Comment.deleted_utc == 0, Comment.parent_submission.notin_(private)) - + comments = comments.filter( + Comment.is_banned == False, + Comment.deleted_utc == 0, + Submission.private == False, + Comment.author_id.notin_(v.userblocks), + ) if not v.paid_dues: - club = [x[0] for x in g.db.query(Submission.id).filter(Submission.club == True).all()] - comments = comments.filter(Comment.parent_submission.notin_(club)) - + comments = comments.filter(Submission.club == False) if gt: comments = comments.filter(Comment.created_utc > gt) if lt: comments = comments.filter(Comment.created_utc < lt)