sfd
This commit is contained in:
parent
a41b80c1f0
commit
155d56d012
3 changed files with 11 additions and 19 deletions
|
@ -46,19 +46,7 @@ def notif_comment(text, autojanny=False):
|
|||
|
||||
text_html = sanitize(text, alert=True)
|
||||
|
||||
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()
|
||||
|
||||
|
||||
notifs = g.db.query(Notification).filter(Notification.comment_id.in_([x.id for x in existing])).all()
|
||||
for c in notifs: g.db.delete(c)
|
||||
g.db.flush()
|
||||
|
||||
|
||||
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()
|
||||
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]
|
||||
else: return create_comment(text_html, autojanny)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue