destroy the shadow realm (#135)

Co-authored-by: Aevann <randomname42029@gmail.com>
Reviewed-on: rDrama/rDrama#135
pull/136/head
Aevann 2023-02-27 15:38:12 +00:00
parent 88762071aa
commit 984aecec9a
16 changed files with 55 additions and 97 deletions

View File

@ -140,8 +140,7 @@ class Comment(Base):
replies = db.query(Comment).filter_by(parent_comment_id=self.id).order_by(Comment.stickied, Comment.stickied_child_id)
if not self.parent_submission: sort='old'
return sort_objects(sort, replies, Comment,
include_shadowbanned=(v and v.can_see_shadowbanned)).all()
return sort_objects(sort, replies, Comment).all()
@property

View File

@ -1073,7 +1073,7 @@ class User(Base):
@property
@lazy
def can_see_shadowbanned(self):
return (self.admin_level >= PERMS['USER_SHADOWBAN']) or self.shadowbanned
return (self.admin_level >= PERMS['USER_SHADOWBAN'])
@property
@lazy

View File

@ -32,7 +32,7 @@ def get_id(username:str, graceful=False) -> Optional[int]:
return user[0]
def get_user(username:Optional[str], v:Optional[User]=None, graceful=False, include_blocks=False, include_shadowbanned=True) -> Optional[User]:
def get_user(username:Optional[str], v:Optional[User]=None, graceful=False, include_blocks=False) -> Optional[User]:
if not username:
if graceful: return None
abort(404)
@ -52,7 +52,7 @@ def get_user(username:Optional[str], v:Optional[User]=None, graceful=False, incl
user = user.one_or_none()
if not user or (user.shadowbanned and not (include_shadowbanned or (v and v.can_see_shadowbanned))):
if not user:
if graceful: return None
abort(404)
@ -78,7 +78,7 @@ def get_users(usernames:Iterable[str], graceful=False) -> List[User]:
return users
def get_account(id:Union[str, int], v:Optional[User]=None, graceful=False, include_blocks=False, include_shadowbanned=True) -> Optional[User]:
def get_account(id:Union[str, int], v:Optional[User]=None, graceful=False, include_blocks=False) -> Optional[User]:
try:
id = int(id)
except:
@ -87,7 +87,7 @@ def get_account(id:Union[str, int], v:Optional[User]=None, graceful=False, inclu
user = g.db.get(User, id)
if not user or (user.shadowbanned and not (include_shadowbanned or (v and v.can_see_shadowbanned))):
if not user:
if not graceful: abort(404)
else: return None
@ -96,7 +96,7 @@ def get_account(id:Union[str, int], v:Optional[User]=None, graceful=False, inclu
return user
def get_accounts_dict(ids:Union[Iterable[str], Iterable[int]], v:Optional[User]=None, graceful=False, include_shadowbanned=True) -> Optional[dict[int, User]]:
def get_accounts_dict(ids:Union[Iterable[str], Iterable[int]], v:Optional[User]=None, graceful=False) -> Optional[dict[int, User]]:
if not ids: return {}
try:
ids = set([int(id) for id in ids])
@ -105,8 +105,6 @@ def get_accounts_dict(ids:Union[Iterable[str], Iterable[int]], v:Optional[User]=
abort(404)
users = g.db.query(User).filter(User.id.in_(ids))
if not (include_shadowbanned or (v and v.can_see_shadowbanned)):
users = users.filter(User.shadowbanned == None)
users = users.all()
if len(users) != len(ids) and not graceful: abort(404)
return {u.id:u for u in users}
@ -297,10 +295,10 @@ def get_comments(cids:Iterable[int], v:Optional[User]=None, extra:Optional[Calla
else:
output = g.db.query(Comment).join(Comment.author)
if extra: output = extra(output)
output = output.filter(User.shadowbanned == None, Comment.id.in_(cids)).all()
output = output.filter(Comment.id.in_(cids)).all()
return sorted(output, key=lambda x: cids.index(x.id))
def get_comments_v_properties(v:User, include_shadowbanned=True, should_keep_func:Optional[Callable[[Comment], bool]]=None, *criterion):
def get_comments_v_properties(v:User, should_keep_func:Optional[Callable[[Comment], bool]]=None, *criterion):
if not v:
raise TypeError("A user is required")
votes = g.db.query(CommentVote.vote_type, CommentVote.comment_id).filter_by(user_id=v.id).subquery()
@ -313,9 +311,6 @@ def get_comments_v_properties(v:User, include_shadowbanned=True, should_keep_fun
blocked.c.target_id,
)
if not include_shadowbanned and not v.can_see_shadowbanned:
comments = comments.join(Comment.author).filter(User.shadowbanned == None)
comments = comments.filter(*criterion)
comments = comments.outerjoin(
votes,

View File

@ -22,11 +22,7 @@ def apply_time_filter(t, objects, cls):
return objects.filter(cls.created_utc >= cutoff)
def sort_objects(sort, objects, cls, include_shadowbanned=False):
if not include_shadowbanned:
cls_user = cls.__mapper__.relationships['author'].entity.entity
objects = objects.join(cls.author).filter(cls_user.shadowbanned == None)
def sort_objects(sort, objects, cls):
if sort == 'hot':
ti = int(time.time()) + 3600
metric = cls.realupvotes

View File

@ -69,7 +69,7 @@ def submit_marsey(v:User):
if not tags_regex.fullmatch(tags):
return error("Invalid tags!")
author = get_user(username, v=v, graceful=True, include_shadowbanned=False)
author = get_user(username, v=v, graceful=True)
if not author:
return error(f"A user with the name '{username}' was not found!")
@ -260,7 +260,7 @@ def submit_hat(v:User):
if not description_regex.fullmatch(description):
return error("Invalid description!")
author = get_user(username, v=v, graceful=True, include_shadowbanned=False)
author = get_user(username, v=v, graceful=True)
if not author:
return error(f"A user with the name '{username}' was not found!")

View File

@ -110,7 +110,7 @@ def comment(v:User):
ghost = parent.ghost
elif parent_fullname.startswith("c_"):
parent = get_comment(id, v=v)
post_target = get_post(parent.parent_submission, v=v, graceful=True) or get_account(parent.wall_user_id, v=v, include_blocks=True, include_shadowbanned=False)
post_target = get_post(parent.parent_submission, v=v, graceful=True) or get_account(parent.wall_user_id, v=v, include_blocks=True)
parent_comment_id = parent.id
if parent.author_id == v.id: rts = True
if not v.can_post_in_ghost_threads and isinstance(post_target, Submission) and post_target.ghost:

View File

@ -114,8 +114,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
word = word.replace('\\', '').replace('_', '\_').replace('%', '\%').strip()
posts=posts.filter(not_(Submission.title.ilike(f'%{word}%')))
posts = sort_objects(sort, posts, Submission,
include_shadowbanned=(v and v.can_see_shadowbanned))
posts = sort_objects(sort, posts, Submission)
if v: size = v.frontsize or 0
else: size = PAGE_SIZE
@ -178,7 +177,7 @@ def random_post(v:User):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@auth_required
def random_user(v:User):
u = g.db.query(User.username).filter(User.song != None, User.shadowbanned == None).order_by(func.random()).first()
u = g.db.query(User.username).filter(User.song != None).order_by(func.random()).first()
if u: u = u[0]
else: abort(404, "No users have set a profile anthem so far!")
@ -207,8 +206,7 @@ def comment_idlist(v=None, page=1, sort="new", t="day", gt=0, lt=0, site=None):
if not gt and not lt:
comments = apply_time_filter(t, comments, Comment)
comments = sort_objects(sort, comments, Comment,
include_shadowbanned=(v and v.can_see_shadowbanned))
comments = sort_objects(sort, comments, Comment)
comments = comments.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE + 1).all()
return [x[0] for x in comments]

View File

@ -92,9 +92,7 @@ def notifications_messages(v:User):
Comment.parent_submission == None,
Comment.level == 1,
)
if not v.shadowbanned and v.admin_level < PERMS['NOTIFICATIONS_FROM_SHADOWBANNED_USERS']:
message_threads = message_threads.join(Comment.author) \
.filter(User.shadowbanned == None)
thread_order = g.db.query(Comment.top_comment_id, Comment.created_utc) \
.distinct(Comment.top_comment_id) \
@ -306,7 +304,6 @@ def notifications(v:User):
if v.admin_level < PERMS['USER_SHADOWBAN']:
comments = comments.filter(
User.shadowbanned == None,
Comment.is_banned == False,
Comment.deleted_utc == 0,
)

View File

@ -104,8 +104,7 @@ def post_id(pid, anything=None, v=None, sub=None):
comments, output = get_comments_v_properties(v, True, None, Comment.parent_submission == post.id, Comment.level < 10)
pinned = [c[0] for c in comments.filter(Comment.stickied != None).order_by(Comment.created_utc.desc()).all()]
comments = comments.filter(Comment.level == 1, Comment.stickied == None)
comments = sort_objects(sort, comments, Comment,
include_shadowbanned=(v and v.can_see_shadowbanned))
comments = sort_objects(sort, comments, Comment)
comments = [c[0] for c in comments.all()]
else:
pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.stickied != None).order_by(Comment.created_utc.desc()).all()
@ -116,8 +115,7 @@ def post_id(pid, anything=None, v=None, sub=None):
Comment.stickied == None
)
comments = sort_objects(sort, comments, Comment,
include_shadowbanned=False)
comments = sort_objects(sort, comments, Comment)
comments = comments.all()
@ -192,8 +190,7 @@ def view_more(v, pid, sort, offset):
# output is needed: see comments.py
comments, output = get_comments_v_properties(v, True, None, Comment.parent_submission == pid, Comment.stickied == None, Comment.id.notin_(ids), Comment.level < 10)
comments = comments.filter(Comment.level == 1)
comments = sort_objects(sort, comments, Comment,
include_shadowbanned=(v and v.can_see_shadowbanned))
comments = sort_objects(sort, comments, Comment)
comments = [c[0] for c in comments.all()]
else:
@ -204,8 +201,7 @@ def view_more(v, pid, sort, offset):
Comment.id.notin_(ids)
)
comments = sort_objects(sort, comments, Comment,
include_shadowbanned=False)
comments = sort_objects(sort, comments, Comment)
comments = comments.offset(offset).all()

View File

@ -72,7 +72,7 @@ def searchposts(v:User):
if 'author' in criteria:
posts = posts.filter(Submission.ghost == False)
author = get_user(criteria['author'], v=v, include_shadowbanned=False)
author = get_user(criteria['author'], v=v)
if not author.is_visible_to(v):
if v.client:
abort(403, f"@{author.username}'s profile is private; You can't use the 'author' syntax on them")
@ -148,8 +148,7 @@ def searchposts(v:User):
posts = apply_time_filter(t, posts, Submission)
posts = sort_objects(sort, posts, Submission,
include_shadowbanned=(v and v.can_see_shadowbanned))
posts = sort_objects(sort, posts, Submission)
total = posts.count()
@ -207,7 +206,7 @@ def searchcomments(v:User):
if 'author' in criteria:
comments = comments.filter(Comment.ghost == False)
author = get_user(criteria['author'], v=v, include_shadowbanned=False)
author = get_user(criteria['author'], v=v)
if not author.is_visible_to(v):
if v.client:
abort(403, f"@{author.username}'s profile is private; You can't use the 'author' syntax on them")
@ -262,8 +261,7 @@ def searchcomments(v:User):
except: abort(400)
comments = comments.filter(Comment.created_utc < before)
comments = sort_objects(sort, comments, Comment,
include_shadowbanned=(v and v.can_see_shadowbanned))
comments = sort_objects(sort, comments, Comment)
total = comments.count()
@ -310,7 +308,7 @@ def searchmessages(v:User):
if 'author' in criteria:
comments = comments.filter(Comment.ghost == False)
author = get_user(criteria['author'], v=v, include_shadowbanned=False)
author = get_user(criteria['author'], v=v)
if not author.is_visible_to(v):
if v.client:
abort(403, f"@{author.username}'s profile is private; You can't use the 'author' syntax on them")
@ -347,8 +345,7 @@ def searchmessages(v:User):
except: abort(400)
comments = comments.filter(Comment.created_utc < before)
comments = sort_objects(sort, comments, Comment,
include_shadowbanned=(v and v.can_see_shadowbanned))
comments = sort_objects(sort, comments, Comment)
total = comments.count()
@ -387,9 +384,6 @@ def searchusers(v:User):
)
)
if v.admin_level < PERMS['USER_SHADOWBAN']:
users = users.filter(User.shadowbanned == None)
users=users.order_by(User.username.ilike(term).desc(), User.stored_subscriber_count.desc())
total=users.count()

View File

@ -91,7 +91,6 @@ def get_leaderboard(v):
result = _special_leaderboard_get()
if g.is_api_or_xhr: return result
users = get_accounts_dict([r[0] for r in result],
v=v, include_shadowbanned=False, graceful=True)
users = get_accounts_dict([r[0] for r in result], v=v, graceful=True)
return render_template("special/worldcup22_leaderboard.html",
v=v, result=result, users=users)

View File

@ -51,7 +51,7 @@ def marseys(v:User):
abort(404)
marseys = get_marseys(g.db)
authors = get_accounts_dict([m.author_id for m in marseys], v=v, graceful=True, include_shadowbanned=False)
authors = get_accounts_dict([m.author_id for m in marseys], v=v, graceful=True)
original = os.listdir("/asset_submissions/marseys/original")
for marsey in marseys:
marsey.user = authors.get(marsey.author_id)

View File

@ -271,7 +271,7 @@ def add_mod(v:User, sub):
if not user: abort(400)
user = get_user(user, v=v, include_shadowbanned=False)
user = get_user(user, v=v)
if sub in {'furry','vampire','racist','femboy'} and not v.client and not user.house.lower().startswith(sub):
abort(403, f"@{user.username} needs to be a member of House {sub.capitalize()} to be added as a mod there!")

View File

@ -27,7 +27,7 @@ from files.__main__ import app, cache, limiter
def upvoters_downvoters(v, username, uid, cls, vote_cls, vote_dir, template, standalone):
u = get_user(username, v=v, include_shadowbanned=False)
u = get_user(username, v=v)
if not u.is_visible_to(v): abort(403)
if not (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']): abort(403)
id = u.id
@ -86,7 +86,7 @@ def downvoters_comments(v:User, username, uid):
return upvoters_downvoters(v, username, uid, Comment, CommentVote, -1, "userpage/voted_comments.html", True)
def upvoting_downvoting(v, username, uid, cls, vote_cls, vote_dir, template, standalone):
u = get_user(username, v=v, include_shadowbanned=False)
u = get_user(username, v=v)
if not u.is_visible_to(v): abort(403)
if not (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']): abort(403)
id = u.id
@ -145,7 +145,7 @@ def downvoting_comments(v:User, username, uid):
return upvoting_downvoting(v, username, uid, Comment, CommentVote, -1, "userpage/voted_comments.html", True)
def user_voted(v, username, cls, vote_cls, template, standalone):
u = get_user(username, v=v, include_shadowbanned=False)
u = get_user(username, v=v)
if not u.is_visible_to(v): abort(403)
if not (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']): abort(403)
@ -196,8 +196,7 @@ def banned(v:User):
User.is_banned != None,
or_(User.unban_utc == 0, User.unban_utc > time.time()),
).order_by(User.ban_reason)
if not v.can_see_shadowbanned:
users = users.filter(User.shadowbanned == None)
users = users.all()
return render_template("banned.html", v=v, users=users)
@ -210,8 +209,7 @@ def grassed(v:User):
User.ban_reason.like('grass award used by @%'),
User.unban_utc > time.time(),
)
if not v.can_see_shadowbanned:
users = users.filter(User.shadowbanned == None)
users = users.all()
return render_template("grassed.html", v=v, users=users)
@ -225,8 +223,7 @@ def chuds(v:User):
)
if v.admin_level >= PERMS['VIEW_LAST_ACTIVE']:
users = users.order_by(User.truescore.desc())
if not v.can_see_shadowbanned:
users = users.filter(User.shadowbanned == None)
users = users.order_by(User.username).all()
return render_template("chuds.html", v=v, users=users)
@ -245,7 +242,7 @@ def all_upvoters_downvoters(v:User, username:str, vote_dir:int, is_who_simps_hat
simps_haters = 'hates' if is_who_simps_hates else 'haters'
vote_name = 'Down'
id = get_user(username, v=v, include_shadowbanned=False).id
id = get_user(username, v=v).id
if not (v.id == id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']):
abort(403)
votes = []
@ -259,8 +256,6 @@ def all_upvoters_downvoters(v:User, username:str, vote_dir:int, is_who_simps_hat
votes = Counter(dict(votes)) + Counter(dict(votes2))
total = sum(votes.values())
users = g.db.query(User).filter(User.id.in_(votes.keys()))
if not v.can_see_shadowbanned:
users = users.filter(User.shadowbanned == None)
users2 = [(user, votes[user.id]) for user in users.all()]
users = sorted(users2, key=lambda x: x[1], reverse=True)
@ -332,13 +327,13 @@ def suicide(v:User, username:str):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@auth_required
def get_coins(v:User, username:str):
user = get_user(username, v=v, include_shadowbanned=False)
user = get_user(username, v=v)
return {"coins": user.coins}
def transfer_currency(v:User, username:str, currency_name:Literal['coins', 'marseybux'], apply_tax:bool):
MIN_CURRENCY_TRANSFER = 100
TAX_PCT = 0.03
receiver = get_user(username, v=v, include_shadowbanned=False)
receiver = get_user(username, v=v)
if receiver.id == v.id: abort(400, f"You can't transfer {currency_name} to yourself!")
amount = request.values.get("amount", "").strip()
amount = int(amount) if amount.isdigit() else None
@ -398,8 +393,6 @@ def transfer_bux(v:User, username:str):
@auth_required
def leaderboard(v:User):
users = g.db.query(User)
if not v.can_see_shadowbanned:
users = users.filter(User.shadowbanned == None)
coins = Leaderboard("Coins", "coins", "coins", "Coins", None, Leaderboard.get_simple_lb, User.coins, v, lambda u:u.coins, g.db, users)
subscribers = Leaderboard("Followers", "followers", "followers", "Followers", "followers", Leaderboard.get_simple_lb, User.stored_subscriber_count, v, lambda u:u.stored_subscriber_count, g.db, users)
@ -505,7 +498,7 @@ def unsubscribe(v, post_id):
@limiter.limit("10/minute;20/hour;50/day", key_func=get_ID)
@is_not_permabanned
def message2(v:User, username:str):
user = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
user = get_user(username, v=v, include_blocks=True)
if user.id == MODMAIL_ID:
abort(403, "Please use /contact to contact the admins")
@ -712,7 +705,7 @@ def redditor_moment_redirect(v:User, username:str):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@auth_required
def followers(v:User, username:str):
u = get_user(username, v=v, include_shadowbanned=False)
u = get_user(username, v=v)
if not (v.id == u.id or v.admin_level >= PERMS['USER_FOLLOWS_VISIBLE']):
abort(403)
@ -735,7 +728,7 @@ def followers(v:User, username:str):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@auth_required
def blockers(v:User, username:str):
u = get_user(username, v=v, include_shadowbanned=False)
u = get_user(username, v=v)
try: page = int(request.values.get("page", 1))
except: page = 1
@ -755,7 +748,7 @@ def blockers(v:User, username:str):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@auth_required
def following(v:User, username:str):
u = get_user(username, v=v, include_shadowbanned=False)
u = get_user(username, v=v)
if not (v.id == u.id or v.admin_level >= PERMS['USER_FOLLOWS_VISIBLE']):
abort(403)
@ -777,7 +770,7 @@ def following(v:User, username:str):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@auth_required
def visitors(v:User, username:str):
u = get_user(username, v=v, include_shadowbanned=False)
u = get_user(username, v=v)
try: page = int(request.values.get("page", 1))
except: page = 1
@ -791,12 +784,11 @@ def visitors(v:User, username:str):
@cache.memoize()
def userpagelisting(user:User, site=None, v=None, page:int=1, sort="new", t="all"):
if user.shadowbanned and not (v and v.can_see_shadowbanned): return []
posts = g.db.query(Submission.id).filter_by(author_id=user.id, is_pinned=False)
if not (v and (v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or v.id == user.id)):
posts = posts.filter_by(is_banned=False, private=False, ghost=False, deleted_utc=0)
posts = apply_time_filter(t, posts, Submission)
posts = sort_objects(sort, posts, Submission, include_shadowbanned=v and v.can_see_shadowbanned)
posts = sort_objects(sort, posts, Submission)
posts = posts.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE+1).all()
return [x[0] for x in posts]
@ -805,7 +797,7 @@ def userpagelisting(user:User, site=None, v=None, page:int=1, sort="new", t="all
@limiter.limit(DEFAULT_RATELIMIT)
@auth_desired_with_logingate
def u_username_wall(v:Optional[User], username:str):
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
u = get_user(username, v=v, include_blocks=True)
if username != u.username:
return redirect(f"/@{u.username}")
@ -911,7 +903,7 @@ def u_username_wall_comment(v:User, username:str, cid):
@limiter.limit(DEFAULT_RATELIMIT)
@auth_desired_with_logingate
def u_username(v:Optional[User], username:str):
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
u = get_user(username, v=v, include_blocks=True)
if username != u.username:
return redirect(SITE_FULL + request.full_path.replace(username, u.username))
@ -989,7 +981,7 @@ def u_username(v:Optional[User], username:str):
@limiter.limit(DEFAULT_RATELIMIT)
@auth_desired_with_logingate
def u_username_comments(username, v=None):
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
u = get_user(username, v=v, include_blocks=True)
if username != u.username:
return redirect(f"/@{u.username}/comments")
@ -1037,8 +1029,7 @@ def u_username_comments(username, v=None):
comments = apply_time_filter(t, comments, Comment)
comments = sort_objects(sort, comments, Comment,
include_shadowbanned=(v and v.can_see_shadowbanned))
comments = sort_objects(sort, comments, Comment)
comments = comments.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE+1).all()
ids = [x.id for x in comments]
@ -1060,7 +1051,7 @@ def u_username_comments(username, v=None):
@auth_required
def u_username_info(username, v=None):
user=get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
user=get_user(username, v=v, include_blocks=True)
if hasattr(user, 'is_blocking') and user.is_blocking:
abort(401, f"You're blocking @{user.username}")
@ -1075,7 +1066,7 @@ def u_username_info(username, v=None):
@auth_required
def u_user_id_info(id, v=None):
user=get_account(id, v=v, include_blocks=True, include_shadowbanned=False)
user=get_account(id, v=v, include_blocks=True)
if hasattr(user, 'is_blocking') and user.is_blocking:
abort(403, f"You're blocking @{user.username}")
@ -1091,7 +1082,7 @@ def u_user_id_info(id, v=None):
@auth_required
def follow_user(username, v):
target = get_user(username, v=v, include_shadowbanned=False)
target = get_user(username, v=v)
if target.id==v.id:
abort(400, "You can't follow yourself!")

View File

@ -29,9 +29,6 @@ def vote_info_get(v, link):
Vote.submission_id == thing.id,
).order_by(Vote.created_utc)
if not v.can_see_shadowbanned:
query = query.filter(User.shadowbanned == None)
ups = query.filter(Vote.vote_type == 1).all()
downs = query.filter(Vote.vote_type == -1).all()
@ -40,9 +37,6 @@ def vote_info_get(v, link):
CommentVote.comment_id == thing.id,
).order_by(CommentVote.created_utc)
if not v.can_see_shadowbanned:
query = query.filter(User.shadowbanned == None)
ups = query.filter(CommentVote.vote_type == 1).all()
downs = query.filter(CommentVote.vote_type == -1).all()
@ -146,8 +140,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
# this is hacky but it works, we should probably do better later
def get_vote_count(dir, real_instead_of_dir):
votes = g.db.query(vote_cls).join(vote_cls.user) \
.filter(User.shadowbanned == None)
votes = g.db.query(vote_cls)
if real_instead_of_dir:
votes = votes.filter(vote_cls.real == True)
else:

View File

@ -233,7 +233,7 @@
<span id="profile--alts">{{alts|length}} Alt{{macros.plural(alts|length)}}:</span>
{% endif %}
<ul id="profile--alts-list">
{% for account in alts if v.can_see_shadowbanned or not account.shadowbanned %}
{% for account in alts %}
<li><a href="{{account.url}}">@{{account.username}}</a>{% if account._is_manual %} [m]{% endif %}</li>
{% endfor %}
</ul>
@ -501,7 +501,7 @@
<span id="profile-mobile--alts">{{alts|length}} Alt{{macros.plural(alts|length)}}:</span>
{% endif %}
<ul id="profile-mobile--alts-list">
{% for account in alts if v.can_see_shadowbanned or not account.shadowbanned %}
{% for account in alts %}
<li><a href="{{account.url}}">@{{account.username}}</a>{% if account._is_manual %} [m]{% endif %}</li>
{% endfor %}
</ul>