forked from rDrama/rDrama
fix 500 errors
parent
15088e5eef
commit
8101e7d91b
|
@ -719,11 +719,6 @@ def u_username_wall(username, v=None):
|
|||
if username != u.username:
|
||||
return redirect(f"/@{u.username}")
|
||||
|
||||
if not u.is_visible_to(v):
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"@{u.username}'s userpage is private")
|
||||
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
|
||||
|
||||
if v and hasattr(u, 'is_blocking') and u.is_blocking:
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"You are blocking @{u.username}.")
|
||||
|
@ -731,6 +726,11 @@ def u_username_wall(username, v=None):
|
|||
|
||||
is_following = v and u.has_follower(v)
|
||||
|
||||
if not u.is_visible_to(v):
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"@{u.username}'s userpage is private")
|
||||
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
|
||||
|
||||
if v and v.id != u.id:
|
||||
g.db.flush()
|
||||
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
|
||||
|
@ -779,11 +779,6 @@ def u_username_wall_comment(username, cid, v=None):
|
|||
|
||||
u = comment.wall_user
|
||||
|
||||
if not u.is_visible_to(v):
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"@{u.username}'s userpage is private")
|
||||
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
|
||||
|
||||
if v and hasattr(u, 'is_blocking') and u.is_blocking:
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"You are blocking @{u.username}.")
|
||||
|
@ -791,6 +786,11 @@ def u_username_wall_comment(username, cid, v=None):
|
|||
|
||||
is_following = v and u.has_follower(v)
|
||||
|
||||
if not u.is_visible_to(v):
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"@{u.username}'s userpage is private")
|
||||
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
|
||||
|
||||
if v and v.id != u.id:
|
||||
g.db.flush()
|
||||
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
|
||||
|
@ -832,12 +832,6 @@ def u_username(username, v=None):
|
|||
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
|
||||
if username != u.username:
|
||||
return redirect(SITE_FULL + request.full_path.replace(username, u.username))
|
||||
|
||||
if not u.is_visible_to(v):
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"@{u.username}'s userpage is private")
|
||||
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
|
||||
|
||||
|
||||
if v and hasattr(u, 'is_blocking') and u.is_blocking:
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
|
@ -846,6 +840,11 @@ def u_username(username, v=None):
|
|||
|
||||
is_following = v and u.has_follower(v)
|
||||
|
||||
if not u.is_visible_to(v):
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"@{u.username}'s userpage is private")
|
||||
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
|
||||
|
||||
if v and v.id != u.id:
|
||||
g.db.flush()
|
||||
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
|
||||
|
@ -911,11 +910,6 @@ def u_username_comments(username, v=None):
|
|||
if username != u.username:
|
||||
return redirect(f"/@{u.username}/comments")
|
||||
|
||||
if not u.is_visible_to(v):
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"@{u.username}'s userpage is private")
|
||||
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
|
||||
|
||||
if v and hasattr(u, 'is_blocking') and u.is_blocking:
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"You are blocking @{u.username}.")
|
||||
|
@ -923,6 +917,11 @@ def u_username_comments(username, v=None):
|
|||
|
||||
is_following = v and u.has_follower(v)
|
||||
|
||||
if not u.is_visible_to(v):
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"@{u.username}'s userpage is private")
|
||||
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
|
||||
|
||||
if v and v.id != u.id:
|
||||
g.db.flush()
|
||||
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
|
||||
|
|
Loading…
Reference in New Issue