users: add the previous improvements to comments

master
justcool393 2022-10-30 02:36:50 -05:00
parent 7f716a6e72
commit cd60a11180
1 changed files with 5 additions and 14 deletions

View File

@ -645,8 +645,7 @@ def u_username(username, v=None):
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False, rendered=True) u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False, rendered=True)
if username != u.username: if username != u.username:
return redirect(SITE_FULL + request.full_path.replace(username, u.username)) return redirect(SITE_FULL + request.full_path.replace(username, u.username))
is_following = v and u.has_follower(v)
is_following = (v and u.has_follower(v))
if v and v.id not in (u.id, DAD_ID) and u.viewers_recorded: if v and v.id not in (u.id, DAD_ID) and u.viewers_recorded:
g.db.flush() g.db.flush()
@ -726,18 +725,10 @@ def u_username(username, v=None):
@app.get("/logged_out/@<username>/comments") @app.get("/logged_out/@<username>/comments")
@auth_desired_with_logingate @auth_desired_with_logingate
def u_username_comments(username, v=None): def u_username_comments(username, v=None):
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False, rendered=True)
user = get_user(username, v=v, include_blocks=True, include_shadowbanned=False, rendered=True) if username != u.username:
return redirect(f"/@{u.username}/comments")
if v and username == v.username: is_following = v and u.has_follower(v)
is_following = False
else:
is_following = (v and user.has_follower(v))
if username != user.username:
return redirect(f'/@{user.username}/comments')
u = user
if not u.is_visible_to(v): if not u.is_visible_to(v):
if g.is_api_or_xhr or request.path.endswith(".json"): if g.is_api_or_xhr or request.path.endswith(".json"):