handle edge case when a new user tried to DM a janny and gets undersieged, resulting in duplicate notifications

pull/198/head
Aevann 2023-09-05 15:04:24 +03:00
parent 7310c55793
commit ef6ead1f82
1 changed files with 1 additions and 0 deletions

View File

@ -651,6 +651,7 @@ def message2(v, username=None, id=None):
c.top_comment_id = c.id
if user.id not in BOT_IDs:
g.db.flush()
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=user.id).one_or_none()
if not notif:
notif = Notification(comment_id=c.id, user_id=user.id)