add profile view even if private or blocked

pull/225/head
Aevann 2024-03-29 22:43:19 +02:00
parent 245bdeb446
commit 6bdf7234dd
1 changed files with 12 additions and 12 deletions

View File

@ -870,6 +870,9 @@ def u_username_wall(v, username):
if username != u.username:
return redirect(f"/@{u.username}" + request.full_path.split(request.path)[1])
if v and v.id != u.id and v.admin_level < PERMS['USER_SHADOWBAN'] and not session.get("GLOBAL"):
gevent.spawn(_add_profile_view, v.id, u.id)
if v and v.has_blocked(u):
if g.is_api_or_xhr:
abort(403, f"You are blocking @{u.username}.")
@ -877,9 +880,6 @@ def u_username_wall(v, username):
is_following = v and u.has_follower(v)
if v and v.id != u.id and v.admin_level < PERMS['USER_SHADOWBAN'] and not session.get("GLOBAL"):
gevent.spawn(_add_profile_view, v.id, u.id)
page = get_page()
if v:
@ -927,6 +927,9 @@ def u_username_wall_comment(v, username, cid):
u = comment.wall_user
if v and v.id != u.id and v.admin_level < PERMS['USER_SHADOWBAN'] and not session.get("GLOBAL"):
gevent.spawn(_add_profile_view, v.id, u.id)
if v and v.has_blocked(u):
if g.is_api_or_xhr:
abort(403, f"You are blocking @{u.username}.")
@ -934,9 +937,6 @@ def u_username_wall_comment(v, username, cid):
is_following = v and u.has_follower(v)
if v and v.id != u.id and v.admin_level < PERMS['USER_SHADOWBAN'] and not session.get("GLOBAL"):
gevent.spawn(_add_profile_view, v.id, u.id)
if v and request.values.get("read"):
gevent.spawn(_mark_comment_as_read, comment.id, v.id)
@ -966,6 +966,9 @@ def u_username(v, username):
if username != u.username:
return redirect(f"/@{u.username}/posts" + request.full_path.split(request.path)[1])
if v and v.id != u.id and v.admin_level < PERMS['USER_SHADOWBAN'] and not session.get("GLOBAL"):
gevent.spawn(_add_profile_view, v.id, u.id)
if v and v.has_blocked(u):
if g.is_api_or_xhr:
abort(403, f"You are blocking @{u.username}.")
@ -978,9 +981,6 @@ def u_username(v, username):
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 and v.admin_level < PERMS['USER_SHADOWBAN'] and not session.get("GLOBAL"):
gevent.spawn(_add_profile_view, v.id, u.id)
sort = request.values.get("sort", "new")
t = request.values.get("t", "all")
page = get_page()
@ -1047,6 +1047,9 @@ def u_username_comments(username, v):
if username != u.username:
return redirect(f"/@{u.username}/comments" + request.full_path.split(request.path)[1])
if v and v.id != u.id and v.admin_level < PERMS['USER_SHADOWBAN'] and not session.get("GLOBAL"):
gevent.spawn(_add_profile_view, v.id, u.id)
if v and v.has_blocked(u):
if g.is_api_or_xhr:
abort(403, f"You are blocking @{u.username}.")
@ -1059,9 +1062,6 @@ def u_username_comments(username, v):
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 and v.admin_level < PERMS['USER_SHADOWBAN'] and not session.get("GLOBAL"):
gevent.spawn(_add_profile_view, v.id, u.id)
page = get_page()
sort = request.values.get("sort","new")