This commit is contained in:
Aevann1 2022-01-30 23:19:59 +02:00
parent 52f88b6352
commit d8ea05ab3d
4 changed files with 256 additions and 251 deletions

View file

@ -604,7 +604,7 @@ def api_comment(v):
g.db.commit()
if request.headers.get("Authorization"): return c.json
return render_template("comments.html", v=v, comments=[c])
return render_template("comments.html", v=v, comments=[c], ajax=True)

View file

@ -338,7 +338,7 @@ def viewmore(v, pid, sort, offset):
if len(comments) == len(comments2): offset = None
comments = comments2
return render_template("comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset)
return render_template("comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset, ajax=True)
@app.post("/morecomments/<cid>")
@ -387,7 +387,7 @@ def morecomments(v, cid):
c = g.db.query(Comment).filter_by(id=cid).one_or_none()
comments = c.replies
return render_template("comments.html", v=v, comments=comments, render_replies=True)
return render_template("comments.html", v=v, comments=comments, render_replies=True, ajax=True)
@app.post("/edit_post/<pid>")
@limiter.limit("1/second;30/minute;200/hour;1000/day")

View file

@ -573,7 +573,7 @@ def messagereply(v):
g.db.add(notif)
g.db.commit()
return render_template("comments.html", v=v, comments=[new_comment])
return render_template("comments.html", v=v, comments=[new_comment], ajax=True)
@app.get("/2faqr/<secret>")
@auth_required

View file

@ -1,3 +1,4 @@
{% if not ajax %}
{% if comment_info and not request.full_path.endswith('#context') %}
<script>
history.pushState(null, null, '#context');
@ -70,6 +71,7 @@
</div>
</div>
</div>
{% endif %}
{% macro single_comment(c, level=1) %}
@ -742,6 +744,7 @@
{% endfor %}
{% if not ajax %}
{% if v %}
{% include "gif_modal.html" %}
{% include "emoji_modal.html" %}
@ -936,6 +939,7 @@
}
{% endif %}
</script>
{% endif %}
{% if offset %}
{% if p %}
@ -944,4 +948,5 @@
<br>
<div id="viewmore-{{offset}}"><button id="viewbtn" class="btn btn-primary" onclick="viewmore({{pid}},'{{sort}}',{{offset}})">VIEW MORE COMMENTS</a></div>
{% endif %}
</body>