bruh
This commit is contained in:
parent
aa461cc781
commit
ce38da9c23
1 changed files with 6 additions and 1 deletions
|
@ -46,7 +46,12 @@ def notif_comment(text, autojanny=False):
|
||||||
|
|
||||||
text_html = sanitize(text, alert=True)
|
text_html = sanitize(text, alert=True)
|
||||||
|
|
||||||
existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).one_or_none()
|
try: existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).one_or_none()
|
||||||
|
except:
|
||||||
|
existing = g.db.query(Comment).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).all()
|
||||||
|
for c in existing: g.db.delete(c)
|
||||||
|
g.db.flush()
|
||||||
|
existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).one_or_none()
|
||||||
|
|
||||||
if existing: return existing[0]
|
if existing: return existing[0]
|
||||||
else: return create_comment(text_html, autojanny)
|
else: return create_comment(text_html, autojanny)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue