forked from MarseyWorld/MarseyWorld
users and search: add status codes
parent
5d2f4d203b
commit
7f716a6e72
|
@ -85,7 +85,7 @@ def searchposts(v):
|
|||
domain=None,
|
||||
domain_obj=None,
|
||||
error=f"@{author.username}'s profile is private; You can't use the 'author' syntax on them."
|
||||
)
|
||||
), 403
|
||||
else: posts = posts.filter(Submission.author_id == author.id)
|
||||
|
||||
if 'q' in criteria:
|
||||
|
@ -199,7 +199,7 @@ def searchcomments(v):
|
|||
if v.client:
|
||||
abort(403, f"@{author.username}'s profile is private; You can't use the 'author' syntax on them")
|
||||
|
||||
return render_template("search_comments.html", v=v, query=query, total=0, page=page, comments=[], sort=sort, t=t, next_exists=False, error=f"@{author.username}'s profile is private; You can't use the 'author' syntax on them.")
|
||||
return render_template("search_comments.html", v=v, query=query, total=0, page=page, comments=[], sort=sort, t=t, next_exists=False, error=f"@{author.username}'s profile is private; You can't use the 'author' syntax on them."), 403
|
||||
|
||||
else: comments = comments.filter(Comment.author_id == author.id)
|
||||
|
||||
|
|
|
@ -742,12 +742,12 @@ def u_username_comments(username, v=None):
|
|||
if not u.is_visible_to(v):
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, "This userpage is private")
|
||||
return render_template("userpage_private.html", u=u, v=v)
|
||||
return render_template("userpage_private.html", u=u, v=v), 403
|
||||
|
||||
if v and hasattr(u, 'is_blocking') and u.is_blocking:
|
||||
if g.is_api_or_xhr or request.path.endswith(".json"):
|
||||
abort(403, f"You are blocking @{u.username}.")
|
||||
return render_template("userpage_blocking.html", u=u, v=v)
|
||||
return render_template("userpage_blocking.html", u=u, v=v), 403
|
||||
|
||||
try: page = max(int(request.values.get("page", "1")), 1)
|
||||
except: page = 1
|
||||
|
|
Loading…
Reference in New Issue