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..ce96480f3f 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 @@ -372,12 +374,14 @@ def morecomments(v, cid): ) output = [] + 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 - output.append(comment) + 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() @@ -511,6 +515,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 +548,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 +1078,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 +1111,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 +1167,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 %}