Added filter for logged out users
This commit is contained in:
parent
716f078e81
commit
c4b5fe2913
1 changed files with 5 additions and 4 deletions
|
@ -165,10 +165,8 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
if not (v and v.shadowbanned) and not (v and v.admin_level > 2):
|
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)
|
comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None)
|
||||||
|
|
||||||
if not v or v.admin_level < 2:
|
if v.admin_level < 2:
|
||||||
filter_clause = (Comment.filter_state != 'filtered') & (Comment.filter_state != 'removed')
|
filter_clause = ((Comment.filter_state != 'filtered') & (Comment.filter_state != 'removed')) | (Comment.author_id == v.id)
|
||||||
if v:
|
|
||||||
filter_clause = filter_clause | (Comment.author_id == v.id)
|
|
||||||
comments = comments.filter(filter_clause)
|
comments = comments.filter(filter_clause)
|
||||||
|
|
||||||
comments=comments.filter(Comment.parent_submission == post.id).join(
|
comments=comments.filter(Comment.parent_submission == post.id).join(
|
||||||
|
@ -225,6 +223,9 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
elif sort == "bottom":
|
elif sort == "bottom":
|
||||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||||
|
|
||||||
|
filter_clause = (Comment.filter_state != 'filtered') & (Comment.filter_state != 'removed')
|
||||||
|
comments = comments.filter(filter_clause)
|
||||||
|
|
||||||
comments = comments.all()
|
comments = comments.all()
|
||||||
|
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue