From 7fb808eb9a9287ff0bd3d11126b7b5e60e769069 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 14 Nov 2021 00:40:38 +0200 Subject: [PATCH] sdfdsf --- files/routes/comments.py | 9 --------- files/routes/posts.py | 42 ++++++++++++++++++---------------------- 2 files changed, 19 insertions(+), 32 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 0b49469a42..8d5fe75cac 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -303,7 +303,6 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_based_html, - body=body2 ) g.db.add(c_based) @@ -335,7 +334,6 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_jannied_html, - body=body2 ) g.db.add(c_jannied) @@ -369,7 +367,6 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_jannied_html, - body=body ) g.db.add(c_jannied) @@ -404,7 +401,6 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_html2, - body=body ) g.db.add(c2) @@ -442,7 +438,6 @@ def api_comment(v): level=level+1, is_bot=True, body_html=body_html2, - body=body ) g.db.add(c2) @@ -469,7 +464,6 @@ def api_comment(v): level=level+2, is_bot=True, body_html=body_html2, - body=body, ) g.db.add(c3) @@ -492,7 +486,6 @@ def api_comment(v): level=level+3, is_bot=True, body_html=body_html2, - body=body ) g.db.add(c4) @@ -709,7 +702,6 @@ def edit_comment(cid, v): level=c.level+1, is_bot=True, body_html=body_jannied_html, - body=body ) g.db.add(c_jannied) @@ -744,7 +736,6 @@ def edit_comment(cid, v): level=c.level+1, is_bot=True, body_html=body_jannied_html, - body=body, ) g.db.add(c_jannied) diff --git a/files/routes/posts.py b/files/routes/posts.py index b51f1b55a1..a7d1bda1ac 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -280,7 +280,6 @@ def edit_post(pid, v): is_pinned=True, distinguish_level=6, body_html=body_jannied_html, - body=body ) g.db.add(c_jannied) @@ -313,7 +312,6 @@ def edit_post(pid, v): is_pinned=True, distinguish_level=6, body_html=body_jannied_html, - body=body ) g.db.add(c_jannied) @@ -823,7 +821,6 @@ def submit_post(v): is_pinned=True, distinguish_level=6, body_html=body_jannied_html, - body=body, ) g.db.add(c_jannied) @@ -858,7 +855,6 @@ def submit_post(v): is_pinned=True, distinguish_level=6, body_html=body_jannied_html, - body=body, ) g.db.add(c_jannied) @@ -910,30 +906,30 @@ def submit_post(v): body_md = CustomRenderer().render(mistletoe.Document(body)) body_html = sanitize(body_md) - c = Comment(author_id=SNAPPY_ACCOUNT, - distinguish_level=6, - parent_submission=new_post.id, - level=1, - over_18=False, - is_bot=request.host!='pcmemes.net', - app_id=None, - body_html=body_html, - body=body, - ) + if len(body_html) < 20000 + c = Comment(author_id=SNAPPY_ACCOUNT, + distinguish_level=6, + parent_submission=new_post.id, + level=1, + over_18=False, + is_bot=request.host!='pcmemes.net', + app_id=None, + body_html=body_html, + ) - g.db.add(c) + g.db.add(c) - snappy = g.db.query(User).filter_by(id = SNAPPY_ACCOUNT).first() - snappy.comment_count += 1 - snappy.coins += 1 - g.db.add(snappy) + snappy = g.db.query(User).filter_by(id = SNAPPY_ACCOUNT).first() + snappy.comment_count += 1 + snappy.coins += 1 + g.db.add(snappy) - g.db.flush() + g.db.flush() - n = Notification(comment_id=c.id, user_id=v.id) - g.db.add(n) - g.db.flush() + n = Notification(comment_id=c.id, user_id=v.id) + g.db.add(n) + g.db.flush() v.post_count = g.db.query(Submission.id).filter_by(author_id=v.id, is_banned=False, deleted_utc=0).count() g.db.add(v)