give an actual error instead of "Forbidden"

master
Aevann 2024-11-15 19:43:30 +02:00
parent 07c0fcf302
commit d281161b68
1 changed files with 6 additions and 4 deletions

View File

@ -212,8 +212,9 @@ def upvoters_downvoters(v, username, username2, cls, vote_cls, vote_dir, templat
u = get_user(username, v=v) u = get_user(username, v=v)
if username == username2: if username == username2:
kind = "posts" if cls == Post else "comments" kind = "post" if cls == Post else "comment"
if not u.is_visible_to(v, 0, kind): stop(403) if not u.is_visible_to(v, 0, f"{kind}s"):
stop(403, f"@{u.username}'s {kind} history is private")
id = u.id id = u.id
@ -282,8 +283,9 @@ def upvoting_downvoting(v, username, username2, cls, vote_cls, vote_dir, templat
u = get_user(username, v=v) u = get_user(username, v=v)
if username == username2: if username == username2:
kind = "posts" if cls == Post else "comments" kind = "post" if cls == Post else "comment"
if not u.is_visible_to(v, 0, kind): stop(403) if not u.is_visible_to(v, 0, f"{kind}s"):
stop(403, f"@{u.username}'s {kind} history is private")
id = u.id id = u.id