From 5ed3a75786f1df3cb127c45e4deb8b44a32ceebf Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 31 Dec 2021 19:38:11 +0200 Subject: [PATCH 1/4] fddsf --- files/routes/comments.py | 9 +++++++++ files/routes/posts.py | 12 +++++++++--- files/templates/authforms.html | 4 ++-- files/templates/default.html | 4 ++-- files/templates/log.html | 4 ++-- files/templates/login.html | 2 +- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 4 ++-- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 4 ++-- 12 files changed, 33 insertions(+), 18 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 399e3a9eb1..cf066f666d 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -330,6 +330,7 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_based_html, + top_comment_id=c.top_comment_id ) g.db.add(c_based) @@ -361,6 +362,7 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_jannied_html, + top_comment_id=c.top_comment_id ) g.db.add(c_jannied) @@ -394,6 +396,7 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_jannied_html, + top_comment_id=c.top_comment_id ) g.db.add(c_jannied) @@ -425,6 +428,7 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_html2, + top_comment_id=c.top_comment_id ) g.db.add(c2) @@ -460,6 +464,7 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_html2, + top_comment_id=c.top_comment_id ) g.db.add(c2) @@ -483,6 +488,7 @@ def api_comment(v): level=level+2, is_bot=True, body_html=body_html2, + top_comment_id=c.top_comment_id ) g.db.add(c3) @@ -499,6 +505,7 @@ def api_comment(v): level=level+3, is_bot=True, body_html=body_html2, + top_comment_id=c.top_comment_id ) g.db.add(c4) @@ -728,6 +735,7 @@ def edit_comment(cid, v): level=c.level+1, is_bot=True, body_html=body_jannied_html, + top_comment_id=c.top_comment_id ) g.db.add(c_jannied) @@ -762,6 +770,7 @@ def edit_comment(cid, v): level=c.level+1, is_bot=True, body_html=body_jannied_html, + top_comment_id=c.top_comment_id ) g.db.add(c_jannied) diff --git a/files/routes/posts.py b/files/routes/posts.py index 35feda0382..1d4ede0d07 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -345,6 +345,8 @@ def viewmore(v, pid, sort, offset): @limiter.limit("1/second") @auth_desired def morecomments(v, cid): + tcid = g.db.query(Comment.top_comment_id).filter_by(id=cid).one_or_none()[0] + if v: votes = g.db.query(CommentVote).filter_by(user_id=v.id).subquery() @@ -357,7 +359,7 @@ def morecomments(v, cid): votes.c.vote_type, blocking.c.id, blocked.c.id, - ).filter_by(parent_comment_id=cid).join( + ).filter(Comment.top_comment_id == tcid, Comment.level > 10).join( votes, votes.c.comment_id == Comment.id, isouter=True @@ -377,7 +379,7 @@ def morecomments(v, cid): comment.voted = c[1] or 0 comment.is_blocking = c[2] or 0 comment.is_blocked = c[3] or 0 - output.append(comment) + if c[0].parent_comment_id == int(cid): output.append(comment) comments = output else: c = g.db.query(Comment).filter_by(id=cid).first() @@ -511,6 +513,7 @@ def edit_post(pid, v): is_pinned='AutoJanny', distinguish_level=6, body_html=body_jannied_html, + top_comment_id=c.top_comment_id ) g.db.add(c_jannied) @@ -543,6 +546,7 @@ def edit_post(pid, v): is_pinned='AutoJanny', distinguish_level=6, body_html=body_jannied_html, + top_comment_id=c.top_comment_id ) g.db.add(c_jannied) @@ -1072,6 +1076,7 @@ def submit_post(v): is_pinned='AutoJanny', distinguish_level=6, body_html=body_jannied_html, + top_comment_id=c.top_comment_id ) g.db.add(c_jannied) @@ -1104,6 +1109,7 @@ def submit_post(v): is_pinned='AutoJanny', distinguish_level=6, body_html=body_jannied_html, + top_comment_id=c.top_comment_id ) g.db.add(c_jannied) @@ -1159,7 +1165,7 @@ def submit_post(v): over_18=False, is_bot=True, app_id=None, - body_html=body_html, + body_html=body_html ) g.db.add(c) diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 3aca497ab5..006c267c50 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,7 +15,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 85571ac705..4f808176c0 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -7,7 +7,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/log.html b/files/templates/log.html index 642c02a6ee..50f3d809f0 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -6,7 +6,7 @@ {% block content %} {% if v %} - + {% if v.agendaposter %} - + {% endif %}
diff --git a/files/templates/login.html b/files/templates/login.html index b655defda6..7949201934 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -18,7 +18,7 @@ {% endblock %} - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index d2dc2cb4fa..1df51ebd4a 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -14,7 +14,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index 8d171a00c9..eff79a7184 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -34,7 +34,7 @@ - + {% if v.agendaposter %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 2886c54e0d..e56e2412b4 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index c69b0aa427..6c55b27c37 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -32,7 +32,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 32258bf944..27de350829 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -26,7 +26,7 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %} - + {% endif %} {% endblock %} From 720dcb80e569f61c2125b369dfdb59be42ecee09 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 31 Dec 2021 19:41:27 +0200 Subject: [PATCH 2/4] fsd --- files/routes/posts.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 1d4ede0d07..dd52e67a47 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -374,13 +374,15 @@ def morecomments(v, cid): ) output = [] + output2 = [] 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 - if c[0].parent_comment_id == int(cid): output.append(comment) - comments = output + output.append(comment) + if c[0].parent_comment_id == int(cid): output2.append(comment) + comments = output2 else: c = g.db.query(Comment).filter_by(id=cid).first() comments = c.replies From b54a3034fadb8ee495c688e4ef3840c0d84f067e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 31 Dec 2021 19:59:06 +0200 Subject: [PATCH 3/4] 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 dd52e67a47..93caa29d85 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -380,8 +380,8 @@ def morecomments(v, cid): comment.voted = c[1] or 0 comment.is_blocking = c[2] or 0 comment.is_blocked = c[3] or 0 - output.append(comment) if c[0].parent_comment_id == int(cid): output2.append(comment) + else: output.append(comment) comments = output2 else: c = g.db.query(Comment).filter_by(id=cid).first() From 568b86011093e05ba195d922d69bc44d5ff05ebd Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 31 Dec 2021 19:59:24 +0200 Subject: [PATCH 4/4] fds --- files/routes/posts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 93caa29d85..ce96480f3f 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -374,15 +374,15 @@ def morecomments(v, cid): ) output = [] - output2 = [] + dump = [] 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 - if c[0].parent_comment_id == int(cid): output2.append(comment) - else: output.append(comment) - comments = output2 + if c[0].parent_comment_id == int(cid): output.append(comment) + else: dump.append(comment) + comments = output else: c = g.db.query(Comment).filter_by(id=cid).first() comments = c.replies