From a3180fad2a8d9dfec4fe1783b3a65a1d283605b1 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Mon, 24 Jul 2023 04:07:17 -0700 Subject: [PATCH] Make commenting the default (#646) --- files/routes/users.py | 45 ++++++------ files/templates/admin/admin_home.html | 6 +- .../templates/admin/filtered_submissions.html | 8 +-- files/templates/admin/removed_posts.html | 8 +-- files/templates/admin/reported_posts.html | 8 +-- files/templates/header.html | 2 +- files/templates/search.html | 4 +- files/templates/userpage.html | 24 ++----- files/templates/userpage_comments.html | 71 +------------------ files/templates/userpage_submissions.html | 10 +++ 10 files changed, 61 insertions(+), 125 deletions(-) create mode 100644 files/templates/userpage_submissions.html diff --git a/files/routes/users.py b/files/routes/users.py index de8be3825..25809fb07 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -646,13 +646,12 @@ def visitors(v): return render_template("viewers.html", v=v, viewers=viewers) -@app.get("/@") +@app.get("/@/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("/@/comments") +@app.get("/@/") @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("/@/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/") diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index 4c895620c..08a549dfd 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -17,13 +17,13 @@

Content

Filtering

Users

diff --git a/files/templates/admin/filtered_submissions.html b/files/templates/admin/filtered_submissions.html index dcc4518cc..3416b046a 100644 --- a/files/templates/admin/filtered_submissions.html +++ b/files/templates/admin/filtered_submissions.html @@ -23,13 +23,13 @@ diff --git a/files/templates/admin/removed_posts.html b/files/templates/admin/removed_posts.html index 7f35da0a0..62dffd062 100644 --- a/files/templates/admin/removed_posts.html +++ b/files/templates/admin/removed_posts.html @@ -20,13 +20,13 @@ diff --git a/files/templates/admin/reported_posts.html b/files/templates/admin/reported_posts.html index 50b542679..a965478ee 100644 --- a/files/templates/admin/reported_posts.html +++ b/files/templates/admin/reported_posts.html @@ -20,13 +20,13 @@ diff --git a/files/templates/header.html b/files/templates/header.html index 598d51b12..2cca528bb 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -11,7 +11,7 @@
-