forked from rDrama/rDrama
master
parent
8576fa5269
commit
c708111e0e
|
@ -220,8 +220,8 @@ def unsubscribe(v, post_id):
|
||||||
def message2(v, username):
|
def message2(v, username):
|
||||||
|
|
||||||
user = get_user(username, v=v)
|
user = get_user(username, v=v)
|
||||||
if user.is_blocking: return {"error": "You're blocking this user."}, 403
|
if hasattr(user, 'is_blocking') and user.is_blocking: return {"error": "You're blocking this user."}, 403
|
||||||
if user.is_blocked: return {"error": "This user is blocking you."}, 403
|
if hasattr(user, 'is_blocked') and user.is_blocked: return {"error": "This user is blocking you."}, 403
|
||||||
message = request.values.get("message", "")[:1000].strip()
|
message = request.values.get("message", "")[:1000].strip()
|
||||||
|
|
||||||
message = message.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
message = message.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
||||||
|
@ -421,13 +421,13 @@ def u_username(username, v=None):
|
||||||
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
||||||
else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
|
else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
|
||||||
|
|
||||||
|
|
||||||
if u.is_blocking and (not v or v.admin_level < 3):
|
if hasattr(u, 'is_blocking') and u.is_blocking and (not v or v.admin_level < 3):
|
||||||
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
|
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
|
||||||
else: return render_template("userpage_blocking.html", u=u, v=v)
|
else: return render_template("userpage_blocking.html", u=u, v=v)
|
||||||
|
|
||||||
|
|
||||||
if u.is_blocked and (not v or v.admin_level < 3):
|
if hasattr(u, 'is_blocked') and u.is_blocked and (not v or v.admin_level < 3):
|
||||||
if request.headers.get("Authorization"): return {"error": "This person is blocking you."}
|
if request.headers.get("Authorization"): return {"error": "This person is blocking you."}
|
||||||
else: return render_template("userpage_blocked.html", u=u, v=v)
|
else: return render_template("userpage_blocked.html", u=u, v=v)
|
||||||
|
|
||||||
|
@ -518,13 +518,13 @@ def u_username_comments(username, v=None):
|
||||||
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
||||||
else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
|
else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
|
||||||
|
|
||||||
if u.is_blocking and (not v or v.admin_level < 3):
|
if hasattr(u, 'is_blocking') and u.is_blocking and (not v or v.admin_level < 3):
|
||||||
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
|
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
|
||||||
else: return render_template("userpage_blocking.html",
|
else: return render_template("userpage_blocking.html",
|
||||||
u=u,
|
u=u,
|
||||||
v=v)
|
v=v)
|
||||||
|
|
||||||
if u.is_blocked and (not v or v.admin_level < 3):
|
if hasattr(u, 'is_blocked') and u.is_blocked and (not v or v.admin_level < 3):
|
||||||
if request.headers.get("Authorization"): return {"error": "This person is blocking you."}
|
if request.headers.get("Authorization"): return {"error": "This person is blocking you."}
|
||||||
else: return render_template("userpage_blocked.html",
|
else: return render_template("userpage_blocked.html",
|
||||||
u=u,
|
u=u,
|
||||||
|
@ -590,9 +590,9 @@ def u_username_info(username, v=None):
|
||||||
|
|
||||||
user=get_user(username, v=v)
|
user=get_user(username, v=v)
|
||||||
|
|
||||||
if user.is_blocking:
|
if hasattr(user, 'is_blocking') and user.is_blocking:
|
||||||
return {"error": "You're blocking this user."}, 401
|
return {"error": "You're blocking this user."}, 401
|
||||||
elif user.is_blocked:
|
elif hasattr(user, 'is_blocked') and user.is_blocked:
|
||||||
return {"error": "This user is blocking you."}, 403
|
return {"error": "This user is blocking you."}, 403
|
||||||
|
|
||||||
return user.json
|
return user.json
|
||||||
|
|
Loading…
Reference in New Issue