forked from MarseyWorld/MarseyWorld
Fix shadow visibility logic.
parent
106160aea6
commit
e5af46c4ae
|
@ -215,7 +215,7 @@ class Comment(Base):
|
|||
if not self.parent_submission: sort='old'
|
||||
|
||||
return sort_objects(sort, replies, Comment,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned))).all()
|
||||
include_shadowbanned=(v and v.can_see_shadowbanned)).all()
|
||||
|
||||
|
||||
@property
|
||||
|
|
|
@ -479,7 +479,7 @@ class User(Base):
|
|||
posts = apply_time_filter(t, posts, Submission)
|
||||
|
||||
posts = sort_objects(sort, posts, Submission,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=(v and v.can_see_shadowbanned))
|
||||
|
||||
posts = posts.offset(25 * (page - 1)).limit(26).all()
|
||||
|
||||
|
@ -980,4 +980,4 @@ class User(Base):
|
|||
@property
|
||||
@lazy
|
||||
def can_see_shadowbanned(self):
|
||||
return self.shadowbanned or self.admin_level >= PERMS['USER_SHADOWBAN']
|
||||
return (self.admin_level >= PERMS['USER_SHADOWBAN']) or self.shadowbanned
|
||||
|
|
|
@ -116,7 +116,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
|
|||
posts = posts.join(Submission.author).filter(User.shadowbanned == None)
|
||||
|
||||
posts = sort_objects(sort, posts, Submission,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=(v and v.can_see_shadowbanned))
|
||||
|
||||
if v: size = v.frontsize or 0
|
||||
else: size = 25
|
||||
|
@ -237,7 +237,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", gt=0, lt=0,
|
|||
comments = apply_time_filter(t, comments, Comment)
|
||||
|
||||
comments = sort_objects(sort, comments, Comment,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=(v and v.can_see_shadowbanned))
|
||||
|
||||
comments = comments.offset(25 * (page - 1)).limit(26).all()
|
||||
return [x[0] for x in comments]
|
||||
|
|
|
@ -197,7 +197,7 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
comments = comments.filter(Comment.level == 1, Comment.stickied == None)
|
||||
|
||||
comments = sort_objects(sort, comments, Comment,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=(v and v.can_see_shadowbanned))
|
||||
|
||||
comments = [c[0] for c in comments.all()]
|
||||
else:
|
||||
|
@ -206,7 +206,7 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
comments = g.db.query(Comment).join(Comment.author).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.level == 1, Comment.stickied == None)
|
||||
|
||||
comments = sort_objects(sort, comments, Comment,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=False)
|
||||
|
||||
comments = comments.all()
|
||||
|
||||
|
@ -319,14 +319,14 @@ def viewmore(v, pid, sort, offset):
|
|||
comments = comments.filter(Comment.level == 1)
|
||||
|
||||
comments = sort_objects(sort, comments, Comment,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=(v and v.can_see_shadowbanned))
|
||||
|
||||
comments = [c[0] for c in comments.all()]
|
||||
else:
|
||||
comments = g.db.query(Comment).join(Comment.author).filter(User.shadowbanned == None, Comment.parent_submission == pid, Comment.level == 1, Comment.stickied == None, Comment.id.notin_(ids))
|
||||
|
||||
comments = sort_objects(sort, comments, Comment,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=False)
|
||||
|
||||
comments = comments.offset(offset).all()
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ def searchposts(v):
|
|||
posts = apply_time_filter(t, posts, Submission)
|
||||
|
||||
posts = sort_objects(sort, posts, Submission,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=(v and v.can_see_shadowbanned))
|
||||
|
||||
total = posts.count()
|
||||
|
||||
|
@ -250,7 +250,7 @@ def searchcomments(v):
|
|||
comments = comments.filter(Comment.created_utc < before)
|
||||
|
||||
comments = sort_objects(sort, comments, Comment,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=(v and v.can_see_shadowbanned))
|
||||
|
||||
total = comments.count()
|
||||
|
||||
|
|
|
@ -910,7 +910,7 @@ def u_username_comments(username, v=None):
|
|||
comments = apply_time_filter(t, comments, Comment)
|
||||
|
||||
comments = sort_objects(sort, comments, Comment,
|
||||
include_shadowbanned=(not (v and v.can_see_shadowbanned)))
|
||||
include_shadowbanned=(v and v.can_see_shadowbanned))
|
||||
|
||||
comments = comments.offset(25 * (page - 1)).limit(26).all()
|
||||
ids = [x.id for x in comments]
|
||||
|
|
Loading…
Reference in New Issue