From 81cc869fe25ca46993419cd8dd00965a03f662ab Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 18 Feb 2023 23:59:17 +0200 Subject: [PATCH] make sure autojanny, zozbot, longpostbot add to the comment count of a post --- files/helpers/actions.py | 10 ++++++++++ files/routes/comments.py | 5 +++++ files/routes/posts.py | 3 +++ 3 files changed, 18 insertions(+) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index fc11a559d..50956f73f 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -261,6 +261,11 @@ def execute_zozbot(c:Comment, level:int, post_target:post_target_type, v): zozbot.pay_account('coins', 1) g.db.add(zozbot) + if posting_to_submission: + post_target.comment_count += 3 + g.db.add(post_target) + + def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_target_type, v:User): if SITE_NAME != 'rDrama': return posting_to_submission = isinstance(post_target, Submission) @@ -299,6 +304,11 @@ def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_ n = Notification(comment_id=c2.id, user_id=v.id) g.db.add(n) + if posting_to_submission: + post_target.comment_count += 3 + g.db.add(post_target) + + def execute_antispam_submission_check(title, v, url): now = int(time.time()) cutoff = now - 60 * 60 * 24 diff --git a/files/routes/comments.py b/files/routes/comments.py index 459e1bfd4..b7b9e9715 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -292,6 +292,11 @@ def comment(v:User): g.db.add(c_jannied) g.db.flush() + if posting_to_submission: + post_target.comment_count += 1 + g.db.add(post_target) + + n = Notification(comment_id=c_jannied.id, user_id=v.id) g.db.add(n) diff --git a/files/routes/posts.py b/files/routes/posts.py index 009d8bead..54a861009 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -767,6 +767,9 @@ def submit_post(v:User, sub=None): g.db.add(c_jannied) g.db.flush() + post.comment_count += 1 + g.db.add(post) + c_jannied.top_comment_id = c_jannied.id n = Notification(comment_id=c_jannied.id, user_id=v.id)