From 1aecb628ceeacbf8209034a42fd56ae0a3bf1292 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:21:38 +0200 Subject: [PATCH] VIEW MORE --- files/classes/comment.py | 1 + files/routes/comments.py | 4 ++++ files/templates/submission.html | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/files/classes/comment.py b/files/classes/comment.py index dd6edb792..164a7b775 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -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) diff --git a/files/routes/comments.py b/files/routes/comments.py index c0144f45a..71867fbf1 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -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, diff --git a/files/templates/submission.html b/files/templates/submission.html index bab6ee38a..2ec1b0dd1 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -811,6 +811,12 @@ {% include "comments.html" %} {% endwith %} + +{% if offset %} +
+ VIEW MORE +{% endif %} + {% elif not p.replies and p.deleted_utc == 0 %}