antispam: hook up duplicate checker

remotes/1693176582716663532/tmp_refs/heads/watchparty
justcool393 2022-11-12 20:48:33 -06:00
parent e809758a75
commit 538497eb55
1 changed files with 7 additions and 3 deletions

View File

@ -213,13 +213,17 @@ def submit_contact(v):
abort(403)
body = f'This message has been sent automatically to all admins via [/contact](/contact)\n\nMessage:\n\n' + body
body += process_files()
body = body.strip()
body_html = sanitize(body)
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
Comment.parent_submission == None,
Comment.level == 1,
Comment.sentto == 2,
Comment.body_html == body_html).first()
if existing: abort(409, f"You already sent that message")
new_comment = Comment(author_id=v.id,
parent_submission=None,
level=1,