VIEW MORE

remotes/1693045480750635534/spooky-22
Aevann1 2021-12-05 04:21:38 +02:00
parent b8f0441327
commit 1aecb628ce
3 changed files with 11 additions and 0 deletions

View File

@ -33,6 +33,7 @@ class Comment(Base):
is_approved = Column(Integer, default=0)
level = Column(Integer, default=0)
parent_comment_id = Column(Integer, ForeignKey("comments.id"))
top_comment_id = Column(Integer)
over_18 = Column(Boolean, default=False)
is_bot = Column(Boolean, default=False)
is_pinned = Column(String)

View File

@ -147,11 +147,14 @@ def api_comment(v):
if parent_fullname.startswith("t2_"):
parent = parent_post
parent_comment_id = None
top_comment_id = None
level = 1
elif parent_fullname.startswith("t3_"):
parent = get_comment(parent_fullname.split("_")[1], v=v)
parent_comment_id = parent.id
level = parent.level + 1
if level == 2: top_comment_id = parent.id
else: top_comment_id = parent.top_comment_id
else: abort(400)
body = request.values.get("body", "").strip()[:10000]
@ -276,6 +279,7 @@ def api_comment(v):
c = Comment(author_id=v.id,
parent_submission=parent_submission,
parent_comment_id=parent_comment_id,
top_comment_id=top_comment_id,
level=level,
over_18=request.host == 'pcmemes.net' and v.id == 1578 or parent_post.over_18 or request.values.get("over_18","")=="true",
is_bot=is_bot,

View File

@ -811,6 +811,12 @@
{% include "comments.html" %}
{% endwith %}
</div>
{% if offset %}
<br>
<a class="pt-2" href="/post/8/kek?offset={{offset}}">VIEW MORE</a>
{% endif %}
{% elif not p.replies and p.deleted_utc == 0 %}
<div class="comment-section text-center py-7">
<span class="fa-stack fa-2x text-muted mb-4">