From 77ed5728c41dc77e22d03bac1e141d5365f26ee4 Mon Sep 17 00:00:00 2001 From: TLSM Date: Mon, 26 Sep 2022 22:44:06 -0400 Subject: [PATCH] Restore mistakenly removed commenting logic. --- files/routes/comments.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/files/routes/comments.py b/files/routes/comments.py index d47cbdd594..b23c2c8d9f 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -325,6 +325,11 @@ def comment(v): g.db.add(c) g.db.flush() + if blackjack and any(i in c.body.lower() for i in blackjack.split()): + v.shadowbanned = 'AutoJanny' + notif = Notification(comment_id=c.id, user_id=CARP_ID) + g.db.add(notif) + if c.level == 1: c.top_comment_id = c.id else: c.top_comment_id = parent.top_comment_id @@ -684,6 +689,14 @@ def edit_comment(cid, v): c.body = body[:10000] c.body_html = body_html + if blackjack and any(i in c.body.lower() for i in blackjack.split()): + v.shadowbanned = 'AutoJanny' + g.db.add(v) + notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=CARP_ID).one_or_none() + if not notif: + notif = Notification(comment_id=c.id, user_id=CARP_ID) + g.db.add(notif) + if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower() and c.post.sub != 'chudrama': return {"error": f'You have to include "{AGENDAPOSTER_PHRASE}" in your comment!'}, 403