Enable JL2 viewing shadowbanned comments.

remotes/1693045480750635534/spooky-22
Snakes 2022-06-12 02:11:59 -04:00
parent 7915eb8390
commit acde2c856b
7 changed files with 9 additions and 9 deletions

View File

@ -75,7 +75,7 @@ class Comment(Base):
@lazy
def flags(self, v):
flags = g.db.query(CommentFlag).filter_by(comment_id=self.id).order_by(CommentFlag.created_utc).all()
if not (v and (v.shadowbanned or v.admin_level > 2)):
if not (v and (v.shadowbanned or v.admin_level >= 2)):
for flag in flags:
if flag.user.shadowbanned:
flags.remove(flag)

View File

@ -79,7 +79,7 @@ class Submission(Base):
@lazy
def flags(self, v):
flags = g.db.query(Flag).filter_by(post_id=self.id).order_by(Flag.created_utc).all()
if not (v and (v.shadowbanned or v.admin_level > 2)):
if not (v and (v.shadowbanned or v.admin_level >= 2)):
for flag in flags:
if flag.user.shadowbanned:
flags.remove(flag)

View File

@ -561,8 +561,8 @@ class User(Base):
'bannerurl': self.banner_url,
'bio_html': self.bio_html_eager,
'coins': self.coins,
'post_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level > 2)) else self.post_count,
'comment_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level > 2)) else self.comment_count,
'post_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level >= 2)) else self.post_count,
'comment_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level >= 2)) else self.comment_count,
'badges': [x.path for x in self.badges],
}

View File

@ -231,7 +231,7 @@ def get_comments(cids, v=None, load_parent=False):
blocked.c.target_id,
).filter(Comment.id.in_(cids))
if not (v and (v.shadowbanned or v.admin_level > 2)):
if not (v and (v.shadowbanned or v.admin_level >= 2)):
comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None)
comments = comments.join(

View File

@ -128,7 +128,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
blocked.c.target_id,
)
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.filter(

View File

@ -166,7 +166,7 @@ def post_id(pid, anything=None, v=None, sub=None):
blocked.c.target_id,
)
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.filter(Comment.parent_submission == post.id, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID))).join(
@ -297,7 +297,7 @@ def viewmore(v, pid, sort, offset):
blocked.c.target_id,
).filter(Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.stickied == None, Comment.id.notin_(ids))
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(

View File

@ -57,7 +57,7 @@
{% set downs=c.downvotes %}
{% set score=ups-downs %}
{% if v and (v.shadowbanned or v.admin_level > 2) %}
{% if v and (v.shadowbanned or v.admin_level >= 2) %}
{% set replies=c.replies3 %}
{% else %}
{% set replies=c.replies %}