From b8f04413277701188ea478787f763c7761649cb4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:21:35 +0200 Subject: [PATCH 01/17] VIEW MORE --- files/routes/posts.py | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 24830b2f8..56cdd1d1b 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -116,6 +116,7 @@ def post_id(pid, anything=None, v=None): if post.club and not (v and (v.paid_dues or v.id == post.author_id)) or post.private and not (v and v.id == post.author_id): abort(403) + pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.is_pinned != None).all() if v: votes = g.db.query(CommentVote).filter_by(user_id=v.id).subquery() @@ -134,10 +135,7 @@ def post_id(pid, anything=None, v=None): if not (v and v.shadowbanned) and not (v and v.admin_level > 1): comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None) - comments=comments.filter( - Comment.parent_submission == post.id, - Comment.author_id != AUTOPOLLER_ID, - ).join( + comments=comments.filter(Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ID, Comment.level == 1, Comment.is_pinned == None).join( votes, votes.c.comment_id == Comment.id, isouter=True @@ -162,6 +160,9 @@ def post_id(pid, anything=None, v=None): elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) + offset = int(request.values.get("offset", 0)) + if offset: comments = comments.offset(offset) + output = [] for c in comments.all(): comment = c[0] @@ -170,10 +171,19 @@ def post_id(pid, anything=None, v=None): comment.is_blocked = c[3] or 0 output.append(comment) - post.replies = [x for x in output if x.is_pinned] + [x for x in output if x.level == 1 and not x.is_pinned] + comments = [] + count = 0 + for comment in output: + comments.append(comment) + count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() + offset += 1 + if count > 3: break + if len(output) == len(comments): offset = None + + post.replies = pinned + comments else: - comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ID) + comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ID, Comment.level == 1, Comment.is_pinned == None) if sort == "new": comments = comments.order_by(Comment.created_utc.desc()) @@ -186,8 +196,23 @@ def post_id(pid, anything=None, v=None): elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) - post.replies = comments.filter(Comment.is_pinned != None).all() + comments.filter(Comment.level == 1, Comment.is_pinned == None).all() + offset = int(request.values.get("offset", 0)) + if offset: comments = comments.offset(offset) + comments = comments.all() + + comments2 = [] + count = 0 + for comment in comments: + comments2.append(comment) + count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() + offset += 1 + if count > 3: break + + if len(comments) == len(comments2): offset = None + + post.replies = pinned + comments2 + if request.host == 'rdrama.net' and pid in [BUG_THREAD, EMOJI_THREAD] and not request.values.get("sort"): post.replies = post.replies[:10] post.views += 1 @@ -202,7 +227,7 @@ def post_id(pid, anything=None, v=None): else: if post.is_banned and not (v and (v.admin_level > 1 or post.author_id == v.id)): template = "submission_banned.html" else: template = "submission.html" - return render_template(template, v=v, p=post, sort=sort, render_replies=True) + return render_template(template, v=v, p=post, sort=sort, render_replies=True, offset=offset) @app.post("/edit_post/") From 1aecb628ceeacbf8209034a42fd56ae0a3bf1292 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:21:38 +0200 Subject: [PATCH 02/17] 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 %}
From 6885ee04607b10db948cef4796cbb7388837018e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:23:39 +0200 Subject: [PATCH 03/17] VIEW MORE --- files/routes/posts.py | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 56cdd1d1b..f483ede15 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -171,17 +171,7 @@ def post_id(pid, anything=None, v=None): comment.is_blocked = c[3] or 0 output.append(comment) - comments = [] - count = 0 - for comment in output: - comments.append(comment) - count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() - offset += 1 - if count > 3: break - - if len(output) == len(comments): offset = None - - post.replies = pinned + comments + comments = output else: comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ID, Comment.level == 1, Comment.is_pinned == None) @@ -201,18 +191,19 @@ def post_id(pid, anything=None, v=None): comments = comments.all() - comments2 = [] - count = 0 - for comment in comments: - comments2.append(comment) - count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() - offset += 1 - if count > 3: break + comments2 = [] + count = 0 + for comment in comments: + comments2.append(comment) + count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() + offset += 1 + if count > 50: break + + if len(comments) == len(comments2): offset = None + + post.replies = pinned + comments2 - if len(comments) == len(comments2): offset = None - post.replies = pinned + comments2 - if request.host == 'rdrama.net' and pid in [BUG_THREAD, EMOJI_THREAD] and not request.values.get("sort"): post.replies = post.replies[:10] post.views += 1 From b48df2aa014f188d0072c8d93830701a714ac1c3 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 02:24:35 +0000 Subject: [PATCH 04/17] schema --- rules_Drama.html | 14 +++++++++++++- schema.sql | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/rules_Drama.html b/rules_Drama.html index 50ad651a4..7cb4cd40d 100644 --- a/rules_Drama.html +++ b/rules_Drama.html @@ -1 +1,13 @@ -fdssdf \ No newline at end of file +Hi I’ll pretty this up eventually, but here are the rules:

+ +

RULE 1

No sexualizing minors even as a “joke.” There is zero tolerance for pedo shit here. Go to Reddit if you want that.

+ +

RULE 2

No doxxing ANYONE.

+ +

RULE 3

Using alts to game dramacoin will get you banned.

+ +

RULE 4

We’re all doing this for fun. Don’t make this “not fun.”

+ +

RULE 5

All rules can and likely will be ignored at admin discretion. Be funny, or at least compelling, and pretty much anything legal is fine.

+ +Okay I think that’s all, thanks for reading! No one cares about your dumb free speech or whatever, go to Gab or something if you want to screech about amendments and stuff. Rules are not hard and fast, and janitorial abuse is inherent to the platform. So is ban evasion. Have fun or log out, both are easy! \ No newline at end of file diff --git a/schema.sql b/schema.sql index 4186bc565..f81ec4720 100644 --- a/schema.sql +++ b/schema.sql @@ -266,7 +266,8 @@ CREATE TABLE public.comments ( body_html character varying(40000), ban_reason character varying(25), notifiedto integer, - realupvotes integer + realupvotes integer, + top_comment_id integer ); @@ -1710,6 +1711,7 @@ ALTER TABLE ONLY public.flags ALTER TABLE ONLY public.notifications ADD CONSTRAINT notifications_comment_id_fkey FOREIGN KEY (comment_id) REFERENCES public.comments(id); + -- -- PostgreSQL database dump complete -- From ee56da59698b53dd40478c591f9dc2e2ea54af89 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:31:23 +0200 Subject: [PATCH 05/17] fdsdsf --- files/routes/posts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index f483ede15..9a68e82de 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -195,9 +195,9 @@ def post_id(pid, anything=None, v=None): count = 0 for comment in comments: comments2.append(comment) - count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() + count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() + 1 offset += 1 - if count > 50: break + if count > 10: break if len(comments) == len(comments2): offset = None From 9a773dc47b7d616dfa2f91308c8485ea562732a4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:36:22 +0200 Subject: [PATCH 06/17] sfdfsd --- files/routes/posts.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 9a68e82de..28a1f3fe1 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -171,7 +171,7 @@ def post_id(pid, anything=None, v=None): comment.is_blocked = c[3] or 0 output.append(comment) - comments = output + comments2 = output else: comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ID, Comment.level == 1, Comment.is_pinned == None) @@ -189,21 +189,21 @@ def post_id(pid, anything=None, v=None): offset = int(request.values.get("offset", 0)) if offset: comments = comments.offset(offset) - comments = comments.all() + comments2 = comments.all() - comments2 = [] - count = 0 - for comment in comments: - comments2.append(comment) - count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() + 1 - offset += 1 - if count > 10: break + if post.created_utc > 1638672040: + comments2 = [] + count = 0 + for comment in comments: + comments2.append(comment) + count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() + 1 + offset += 1 + if count > 10: break - if len(comments) == len(comments2): offset = None + if len(comments) == len(comments2): offset = None post.replies = pinned + comments2 - if request.host == 'rdrama.net' and pid in [BUG_THREAD, EMOJI_THREAD] and not request.values.get("sort"): post.replies = post.replies[:10] post.views += 1 From 3800624ff52be4e0541a39e16ca3447bc594f341 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:37:23 +0200 Subject: [PATCH 07/17] sfdsfd --- files/routes/posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 28a1f3fe1..34611e4c6 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -196,7 +196,7 @@ def post_id(pid, anything=None, v=None): count = 0 for comment in comments: comments2.append(comment) - count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id).count() + 1 + count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id, Comment.parent_submission == post.id).count() + 1 offset += 1 if count > 10: break From e4d8d9888274965347c6ac90b4fafc71b144ef41 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:37:42 +0200 Subject: [PATCH 08/17] fdsfsd --- files/routes/posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 34611e4c6..095b693ea 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -196,7 +196,7 @@ def post_id(pid, anything=None, v=None): count = 0 for comment in comments: comments2.append(comment) - count += g.db.query(Comment.id).filter_by(top_comment_id=comment.id, Comment.parent_submission == post.id).count() + 1 + count += g.db.query(Comment.id).filter_by(Comment.parent_submission == post.id, top_comment_id=comment.id,.count() + 1 offset += 1 if count > 10: break From d44772da8eb8bbf0e86821dfa0bd6d2aeca94fe5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:37:59 +0200 Subject: [PATCH 09/17] fdsfds --- files/routes/posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 095b693ea..9538edc26 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -196,7 +196,7 @@ def post_id(pid, anything=None, v=None): count = 0 for comment in comments: comments2.append(comment) - count += g.db.query(Comment.id).filter_by(Comment.parent_submission == post.id, top_comment_id=comment.id,.count() + 1 + count += g.db.query(Comment.id).filter_by(Comment.parent_submission == post.id, top_comment_id=comment.id).count() + 1 offset += 1 if count > 10: break From d6fb2a307ba348299e9d1729647a1328dda39c38 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:38:15 +0200 Subject: [PATCH 10/17] fdsfds --- files/routes/posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 9538edc26..bd60aa704 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -196,7 +196,7 @@ def post_id(pid, anything=None, v=None): count = 0 for comment in comments: comments2.append(comment) - count += g.db.query(Comment.id).filter_by(Comment.parent_submission == post.id, top_comment_id=comment.id).count() + 1 + count += g.db.query(Comment.id).filter_by(parent_submission=post.id, top_comment_id=comment.id).count() + 1 offset += 1 if count > 10: break From 120739b2a0750ace43770a72d88df1362dcb55d4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:38:27 +0200 Subject: [PATCH 11/17] sfdfsd --- files/routes/posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index bd60aa704..fef238184 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -198,7 +198,7 @@ def post_id(pid, anything=None, v=None): comments2.append(comment) count += g.db.query(Comment.id).filter_by(parent_submission=post.id, top_comment_id=comment.id).count() + 1 offset += 1 - if count > 10: break + if count > 50: break if len(comments) == len(comments2): offset = None From a2ab9d77ff4272eb4a75fc7742fb7669ff02ae29 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:51:14 +0200 Subject: [PATCH 12/17] fdssfd --- files/routes/posts.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index fef238184..d40a623c0 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -135,7 +135,7 @@ def post_id(pid, anything=None, v=None): if not (v and v.shadowbanned) and not (v and v.admin_level > 1): comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None) - comments=comments.filter(Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ID, Comment.level == 1, Comment.is_pinned == None).join( + comments=comments.filter(Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ID, Comment.is_pinned == None).join( votes, votes.c.comment_id == Comment.id, isouter=True @@ -149,6 +149,16 @@ def post_id(pid, anything=None, v=None): isouter=True ) + output = [] + for c in comments.all(): + comment = c[0] + comment.voted = c[1] or 0 + comment.is_blocking = c[2] or 0 + comment.is_blocked = c[3] or 0 + output.append(comment) + + comments = comments.filter(Comment.level == 1) + if sort == "new": comments = comments.order_by(Comment.created_utc.desc()) elif sort == "old": @@ -163,15 +173,7 @@ def post_id(pid, anything=None, v=None): offset = int(request.values.get("offset", 0)) if offset: comments = comments.offset(offset) - output = [] - for c in comments.all(): - comment = c[0] - comment.voted = c[1] or 0 - comment.is_blocking = c[2] or 0 - comment.is_blocked = c[3] or 0 - output.append(comment) - - comments2 = output + comments2 = [c[0] for c in comments.all()] else: comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ID, Comment.level == 1, Comment.is_pinned == None) From 6a5a5a716a7b1635cf3a202c4736c72e74a5ddeb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 04:58:30 +0200 Subject: [PATCH 13/17] fdsfds --- files/routes/posts.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index d40a623c0..0e78ae53e 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -173,7 +173,7 @@ def post_id(pid, anything=None, v=None): offset = int(request.values.get("offset", 0)) if offset: comments = comments.offset(offset) - comments2 = [c[0] for c in comments.all()] + comments = [c[0] for c in comments.all()] else: comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id != AUTOPOLLER_ID, Comment.level == 1, Comment.is_pinned == None) @@ -191,7 +191,7 @@ def post_id(pid, anything=None, v=None): offset = int(request.values.get("offset", 0)) if offset: comments = comments.offset(offset) - comments2 = comments.all() + comments = comments.all() if post.created_utc > 1638672040: comments2 = [] @@ -203,8 +203,9 @@ def post_id(pid, anything=None, v=None): if count > 50: break if len(comments) == len(comments2): offset = None + comments = comments2 - post.replies = pinned + comments2 + post.replies = pinned + comments if request.host == 'rdrama.net' and pid in [BUG_THREAD, EMOJI_THREAD] and not request.values.get("sort"): post.replies = post.replies[:10] From 290b863c6e70e613983f8aae13caf864def99e0d Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 05:05:07 +0200 Subject: [PATCH 14/17] fsdfsd --- files/templates/submission.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/templates/submission.html b/files/templates/submission.html index 2ec1b0dd1..82c746fc1 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -814,7 +814,11 @@ {% if offset %}
- VIEW MORE + {% if '?' in request.full_url %} + VIEW MORE + {% else &} + VIEW MORE + {% endif %} {% endif %} {% elif not p.replies and p.deleted_utc == 0 %} From 090a89e2ef1b92d9c8f6298304e71c317b7e2dd6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 05:05:45 +0200 Subject: [PATCH 15/17] sfdsfd --- files/templates/submission.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/submission.html b/files/templates/submission.html index 82c746fc1..c0554259b 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -816,7 +816,7 @@
{% if '?' in request.full_url %} VIEW MORE - {% else &} + {% else &} VIEW MORE {% endif %} {% endif %} From 29886e2cf3b971141e0f6c15fc53972b2efec0ca Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 05:06:07 +0200 Subject: [PATCH 16/17] fdsdf --- files/templates/submission.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/submission.html b/files/templates/submission.html index c0554259b..a2039799c 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -816,7 +816,7 @@
{% if '?' in request.full_url %} VIEW MORE - {% else &} + {% else %} VIEW MORE {% endif %} {% endif %} From 48851d06ce8195150479684e2ffe9509f1e63ed8 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 05:06:46 +0200 Subject: [PATCH 17/17] sfdfds --- files/templates/submission.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/templates/submission.html b/files/templates/submission.html index a2039799c..af53d8bc6 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -814,10 +814,10 @@ {% if offset %}
- {% if '?' in request.full_url %} - VIEW MORE + {% if '?' in request.full_path %} + VIEW MORE {% else %} - VIEW MORE + VIEW MORE {% endif %} {% endif %}