same as last commit

master
Aevann1 2022-11-12 12:11:46 +02:00
parent a9188f5dac
commit 27a8fd4657
2 changed files with 13 additions and 13 deletions

View File

@ -580,10 +580,10 @@ def settings_block_user(v):
if user.unblockable: if user.unblockable:
if not v.shadowbanned: if not v.shadowbanned:
send_notification(user.id, f"@{v.username} has tried to block you and failed because of your unblockable status!") send_notification(user.id, f"@{v.username} has tried to block you and failed because of your unblockable status!")
abort(403, "This user is unblockable.") abort(403, f"@{user.username} is unblockable!")
if user.id == v.id: abort(400, "You can't block yourself") if user.id == v.id: abort(400, "You can't block yourself")
if user.id == AUTOJANNY_ID: abort(403, "You can't block this user") if user.id == AUTOJANNY_ID: abort(403, f"You can't block @{user.username}")
if v.has_blocked(user): abort(409, f"You have already blocked @{user.username}") if v.has_blocked(user): abort(409, f"You have already blocked @{user.username}")
new_block = UserBlock(user_id=v.id, target_id=user.id) new_block = UserBlock(user_id=v.id, target_id=user.id)

View File

@ -420,10 +420,10 @@ def message2(v, username):
user = get_user(username, v=v, include_blocks=True, include_shadowbanned=False) user = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
if hasattr(user, 'is_blocking') and user.is_blocking: if hasattr(user, 'is_blocking') and user.is_blocking:
abort(403, "You're blocking this user.") abort(403, f"You're blocking @{user.username}")
if v.admin_level <= PERMS['MESSAGE_BLOCKED_USERS'] and hasattr(user, 'is_blocked') and user.is_blocked: if v.admin_level <= PERMS['MESSAGE_BLOCKED_USERS'] and hasattr(user, 'is_blocked') and user.is_blocked:
abort(403, "This user is blocking you.") abort(403, f"@{user.username} is blocking you.")
message = sanitize_raw_body(request.values.get("message"), False) message = sanitize_raw_body(request.values.get("message"), False)
if not message: abort(400, "Message is empty!") if not message: abort(400, "Message is empty!")
@ -502,10 +502,10 @@ def messagereply(v):
if user_id: if user_id:
user = get_account(user_id, v=v, include_blocks=True) user = get_account(user_id, v=v, include_blocks=True)
if hasattr(user, 'is_blocking') and user.is_blocking: if hasattr(user, 'is_blocking') and user.is_blocking:
abort(403, "You're blocking this user.") abort(403, f"You're blocking @{user.username}")
elif (v.admin_level <= PERMS['MESSAGE_BLOCKED_USERS'] elif (v.admin_level <= PERMS['MESSAGE_BLOCKED_USERS']
and hasattr(user, 'is_blocked') and user.is_blocked): and hasattr(user, 'is_blocked') and user.is_blocked):
abort(403, "You're blocked by this user.") abort(403, f"You're blocked by @{user.username}")
if parent.sentto == 2: if parent.sentto == 2:
body += process_files() body += process_files()
@ -686,7 +686,7 @@ def u_username(username, v=None):
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"):
abort(403, "This userpage is private") abort(403, f"@{u.username}'s userpage is private")
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403 return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
@ -755,7 +755,7 @@ def u_username_comments(username, v=None):
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"):
abort(403, "This userpage is private") abort(403, f"@{u.username}'s userpage is private")
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403 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 v and hasattr(u, 'is_blocking') and u.is_blocking:
@ -811,9 +811,9 @@ 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, include_shadowbanned=False)
if hasattr(user, 'is_blocking') and user.is_blocking: if hasattr(user, 'is_blocking') and user.is_blocking:
abort(401, "You're blocking this user.") abort(401, f"You're blocking @{user.username}")
elif hasattr(user, 'is_blocked') and user.is_blocked: elif hasattr(user, 'is_blocked') and user.is_blocked:
abort(403, "This user is blocking you.") abort(403, f"@{user.username} is blocking you.")
return user.json return user.json
@ -824,9 +824,9 @@ 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, include_shadowbanned=False)
if hasattr(user, 'is_blocking') and user.is_blocking: if hasattr(user, 'is_blocking') and user.is_blocking:
abort(403, "You're blocking this user.") abort(403, f"You're blocking @{user.username}")
elif hasattr(user, 'is_blocked') and user.is_blocked: elif hasattr(user, 'is_blocked') and user.is_blocked:
abort(403, "This user is blocking you.") abort(403, f"@{user.username} is blocking you.")
return user.json return user.json
@ -868,7 +868,7 @@ def unfollow_user(username, v):
if target.fish: if target.fish:
if not v.shadowbanned: if not v.shadowbanned:
send_notification(target.id, f"@{v.username} has tried to unfollow you and failed because of your fish award!") send_notification(target.id, f"@{v.username} has tried to unfollow you and failed because of your fish award!")
abort(400, "You can't unfollow this user!") abort(400, f"You can't unfollow @{target.username}")
follow = g.db.query(Follow).filter_by(user_id=v.id, target_id=target.id).one_or_none() follow = g.db.query(Follow).filter_by(user_id=v.id, target_id=target.id).one_or_none()