Restore mistakenly removed commenting logic.

remotes/1693176582716663532/tmp_refs/heads/watchparty
Snakes 2022-09-26 22:44:06 -04:00
parent 92a2224b91
commit 77ed5728c4
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 13 additions and 0 deletions

View File

@ -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