Filter on other pages as well

This commit is contained in:
Julian Rota 2022-06-22 23:38:46 -04:00 committed by Ben Rog-Wilhelm
parent 420e3e1e8e
commit f736d660b6
3 changed files with 15 additions and 7 deletions

View file

@ -282,10 +282,16 @@ def viewmore(v, pid, sort, offset):
blocking.c.target_id,
blocked.c.target_id,
).filter(Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.is_pinned == None, Comment.id.notin_(ids))
if not (v and v.shadowbanned) and not (v and v.admin_level > 2):
comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None)
if not v or v.admin_level < 2:
filter_clause = (Comment.filter_state != 'filtered') & (Comment.filter_state != 'removed')
if v:
filter_clause = filter_clause | (Comment.author_id == v.id)
comments = comments.filter(filter_clause)
comments=comments.join(
votes,
votes.c.comment_id == Comment.id,