From 7fbcec3b824d0c092c5a935bedd3c44b029969f9 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 30 Aug 2022 07:26:13 +0200 Subject: [PATCH] turns out we didnt need a dedicated ajax variable --- files/routes/comments.py | 2 +- files/routes/posts.py | 4 ++-- files/routes/users.py | 2 +- files/templates/comments.html | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index b1ac33858..462b20419 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -638,7 +638,7 @@ def comment(v): g.db.flush() if request.headers.get("Authorization"): return c.json - return {"comment": render_template("comments.html", v=v, comments=[c], ajax=True, new_comment=True)} + return {"comment": render_template("comments.html", v=v, comments=[c], new_comment=True)} diff --git a/files/routes/posts.py b/files/routes/posts.py index ec03a1719..171fd1c28 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -328,7 +328,7 @@ def viewmore(v, pid, sort, offset): else: offset += 1 comments = comments2 - return render_template("comments.html", v=v, comments=comments, p=post, ids=list(ids), render_replies=True, pid=pid, sort=sort, offset=offset, ajax=True) + return render_template("comments.html", v=v, comments=comments, p=post, ids=list(ids), render_replies=True, pid=pid, sort=sort, offset=offset) @app.get("/morecomments/") @@ -383,7 +383,7 @@ def morecomments(v, cid): if comments: p = comments[0].post else: p = None - return render_template("comments.html", v=v, comments=comments, p=p, render_replies=True, ajax=True) + return render_template("comments.html", v=v, comments=comments, p=p, render_replies=True) @app.post("/edit_post/") @limiter.limit("1/second;10/minute;100/hour;200/day") diff --git a/files/routes/users.py b/files/routes/users.py index a6a791172..8eeb982aa 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -805,7 +805,7 @@ def messagereply(v): g.db.delete(n) - return {"comment": render_template("comments.html", v=v, comments=[c], ajax=True)} + return {"comment": render_template("comments.html", v=v, comments=[c])} @app.get("/2faqr/") @auth_required diff --git a/files/templates/comments.html b/files/templates/comments.html index 24f76369c..cb55aca07 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -1,6 +1,6 @@ {%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} -{% if not ajax %} +{% if not request.headers.get("xhr") %} {% if comment_info %}