VIEW MORE
This commit is contained in:
parent
926e4ae6d5
commit
53ed768b3e
3 changed files with 11 additions and 0 deletions
|
@ -33,6 +33,7 @@ class Comment(Base):
|
||||||
is_approved = Column(Integer, default=0)
|
is_approved = Column(Integer, default=0)
|
||||||
level = Column(Integer, default=0)
|
level = Column(Integer, default=0)
|
||||||
parent_comment_id = Column(Integer, ForeignKey("comments.id"))
|
parent_comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||||
|
top_comment_id = Column(Integer)
|
||||||
over_18 = Column(Boolean, default=False)
|
over_18 = Column(Boolean, default=False)
|
||||||
is_bot = Column(Boolean, default=False)
|
is_bot = Column(Boolean, default=False)
|
||||||
is_pinned = Column(String)
|
is_pinned = Column(String)
|
||||||
|
|
|
@ -147,11 +147,14 @@ def api_comment(v):
|
||||||
if parent_fullname.startswith("t2_"):
|
if parent_fullname.startswith("t2_"):
|
||||||
parent = parent_post
|
parent = parent_post
|
||||||
parent_comment_id = None
|
parent_comment_id = None
|
||||||
|
top_comment_id = None
|
||||||
level = 1
|
level = 1
|
||||||
elif parent_fullname.startswith("t3_"):
|
elif parent_fullname.startswith("t3_"):
|
||||||
parent = get_comment(parent_fullname.split("_")[1], v=v)
|
parent = get_comment(parent_fullname.split("_")[1], v=v)
|
||||||
parent_comment_id = parent.id
|
parent_comment_id = parent.id
|
||||||
level = parent.level + 1
|
level = parent.level + 1
|
||||||
|
if level == 2: top_comment_id = parent.id
|
||||||
|
else: top_comment_id = parent.top_comment_id
|
||||||
else: abort(400)
|
else: abort(400)
|
||||||
|
|
||||||
body = request.values.get("body", "").strip()[:10000]
|
body = request.values.get("body", "").strip()[:10000]
|
||||||
|
@ -276,6 +279,7 @@ def api_comment(v):
|
||||||
c = Comment(author_id=v.id,
|
c = Comment(author_id=v.id,
|
||||||
parent_submission=parent_submission,
|
parent_submission=parent_submission,
|
||||||
parent_comment_id=parent_comment_id,
|
parent_comment_id=parent_comment_id,
|
||||||
|
top_comment_id=top_comment_id,
|
||||||
level=level,
|
level=level,
|
||||||
over_18=request.host == 'pcmemes.net' and v.id == 1578 or parent_post.over_18 or request.values.get("over_18","")=="true",
|
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,
|
is_bot=is_bot,
|
||||||
|
|
|
@ -811,6 +811,12 @@
|
||||||
{% include "comments.html" %}
|
{% include "comments.html" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</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 %}
|
{% elif not p.replies and p.deleted_utc == 0 %}
|
||||||
<div class="comment-section text-center py-7">
|
<div class="comment-section text-center py-7">
|
||||||
<span class="fa-stack fa-2x text-muted mb-4">
|
<span class="fa-stack fa-2x text-muted mb-4">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue