From d281161b682542c13f6c12048ff03a2e6a8c3128 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 15 Nov 2024 19:43:30 +0200 Subject: [PATCH] give an actual error instead of "Forbidden" --- files/routes/users.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index c67a33d88..7aef0a320 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -212,8 +212,9 @@ def upvoters_downvoters(v, username, username2, cls, vote_cls, vote_dir, templat u = get_user(username, v=v) if username == username2: - kind = "posts" if cls == Post else "comments" - if not u.is_visible_to(v, 0, kind): stop(403) + kind = "post" if cls == Post else "comment" + if not u.is_visible_to(v, 0, f"{kind}s"): + stop(403, f"@{u.username}'s {kind} history is private") 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) if username == username2: - kind = "posts" if cls == Post else "comments" - if not u.is_visible_to(v, 0, kind): stop(403) + kind = "post" if cls == Post else "comment" + if not u.is_visible_to(v, 0, f"{kind}s"): + stop(403, f"@{u.username}'s {kind} history is private") id = u.id