Make commenting the default (#646)

This commit is contained in:
justcool393 2023-07-24 04:07:17 -07:00 committed by GitHub
parent fb530268bf
commit a3180fad2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 61 additions and 125 deletions

View file

@ -646,13 +646,12 @@ def visitors(v):
return render_template("viewers.html", v=v, viewers=viewers)
@app.get("/@<username>")
@app.get("/@<username>/posts")
@auth_desired
def u_username(username, v=None):
u = get_user(username, v=v, include_blocks=True)
if username != u.username:
return redirect(SITE_FULL + request.full_path.replace(username, u.username)[:-1])
if username != u.username: return redirect(f'/@{u.username}/posts')
if u.reserved:
if request.headers.get("Authorization") or request.headers.get("xhr"): abort(403, f"That username is reserved for: {u.reserved}")
@ -698,7 +697,7 @@ def u_username(username, v=None):
if u.unban_utc:
if request.headers.get("Authorization"): {"data": [x.json for x in listing]}
return render_template("userpage.html",
return render_template("userpage_submissions.html",
unban=u.unban_string,
u=u,
v=v,
@ -712,7 +711,7 @@ def u_username(username, v=None):
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
return render_template("userpage.html",
return render_template("userpage_submissions.html",
u=u,
v=v,
listing=listing,
@ -723,12 +722,13 @@ def u_username(username, v=None):
is_following=(v and u.has_follower(v)))
@app.get("/@<username>/comments")
@app.get("/@<username>/")
@auth_desired
def u_username_comments(username, v=None):
user = get_user(username, v=v, include_blocks=True)
if username != user.username: return redirect(f'/@{user.username}/comments')
if username != user.username:
return redirect(SITE_FULL + request.full_path.replace(username, user.username)[:-1])
u = user
if u.reserved:
@ -935,13 +935,14 @@ def saved_posts(v, username):
listing = get_posts(ids, v=v, eager=True)
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
return render_template("userpage.html",
u=v,
v=v,
listing=listing,
page=page,
next_exists=next_exists,
)
return render_template(
"userpage_submissions.html",
u=v,
v=v,
listing=listing,
page=page,
next_exists=next_exists,
)
@app.get("/@<username>/saved/comments")
@ -959,13 +960,15 @@ def saved_comments(v, username):
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
return render_template("userpage_comments.html",
u=v,
v=v,
listing=listing,
page=page,
next_exists=next_exists,
standalone=True)
return render_template(
"userpage_comments.html",
u=v,
v=v,
listing=listing,
page=page,
next_exists=next_exists,
standalone=True
)
@app.post("/fp/<fp>")