make sure g.db.flush() is always above _push_notif_thread
parent
1848d24993
commit
e37031c4dd
|
@ -265,7 +265,6 @@ def execute_zozbot(c:Comment, level:int, post_target:post_target_type, v):
|
|||
post_target.comment_count += 3
|
||||
g.db.add(post_target)
|
||||
|
||||
g.db.flush()
|
||||
push_notif({v.id}, f'New reply by @zozbot', "zoz", (c2.id,posting_to_submission))
|
||||
|
||||
def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_target_type, v:User):
|
||||
|
@ -310,7 +309,6 @@ def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_
|
|||
post_target.comment_count += 3
|
||||
g.db.add(post_target)
|
||||
|
||||
g.db.flush()
|
||||
push_notif({v.id}, f'New reply by @longpostbot', c2.body, (c2.id,posting_to_submission))
|
||||
|
||||
def execute_antispam_submission_check(title, v, url):
|
||||
|
|
|
@ -38,7 +38,6 @@ def send_repeatable_notification(uid, text):
|
|||
notif = Notification(comment_id=c.id, user_id=uid)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.flush()
|
||||
push_notif({uid}, 'New notification', text, f'{SITE_FULL}/comment/{c.id}?read=true#context')
|
||||
return
|
||||
|
||||
|
@ -46,7 +45,6 @@ def send_repeatable_notification(uid, text):
|
|||
notif = Notification(comment_id=cid, user_id=uid)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.flush()
|
||||
push_notif({uid}, 'New notification', text, f'{SITE_FULL}/comment/{cid}?read=true#context')
|
||||
|
||||
|
||||
|
@ -113,7 +111,6 @@ def add_notif(cid, uid, text):
|
|||
notif = Notification(comment_id=cid, user_id=uid)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.flush()
|
||||
push_notif({uid}, 'New notification', text, f'{SITE_FULL}/comment/{cid}?read=true#context')
|
||||
|
||||
|
||||
|
@ -162,6 +159,7 @@ def push_notif(uids, title, body, url):
|
|||
|
||||
subscriptions = g.db.query(PushSubscription.subscription_json).filter(PushSubscription.user_id.in_(uids)).all()
|
||||
subscriptions = [x[0] for x in subscriptions]
|
||||
g.db.flush()
|
||||
gevent.spawn(_push_notif_thread, subscriptions, title, body, url)
|
||||
|
||||
|
||||
|
|
|
@ -123,5 +123,4 @@ def notify_mentions(mentions, send_to=None, mention_str='site mention'):
|
|||
notif = Notification(comment_id=new_comment.id, user_id=send_to)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.flush()
|
||||
push_notif({send_to}, f'New mention of you on reddit by /u/{author}', new_comment.body, f'{SITE_FULL}/comment/{new_comment.id}?read=true#context')
|
||||
|
|
|
@ -177,7 +177,6 @@ def send_repeatable_notification_duplicated(uid, text):
|
|||
notif = Notification(comment_id=c.id, user_id=uid)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.flush()
|
||||
push_notif({uid}, 'New notification', text, f'{SITE_FULL}/comment/{c.id}?read=true#context')
|
||||
return
|
||||
|
||||
|
@ -185,7 +184,6 @@ def send_repeatable_notification_duplicated(uid, text):
|
|||
notif = Notification(comment_id=cid, user_id=uid)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.flush()
|
||||
push_notif({uid}, 'New notification', text, f'{SITE_FULL}/comment/{cid}?read=true#context')
|
||||
|
||||
|
||||
|
@ -229,7 +227,6 @@ def execute_blackjack(v, target, body, type):
|
|||
n = Notification(comment_id=target.id, user_id=id)
|
||||
g.db.add(n)
|
||||
|
||||
g.db.flush()
|
||||
push_notif(notified_ids, f'Blackjack by @{v.username}', target.body, (target.id,bool(target.wall_user_id)))
|
||||
|
||||
extra_info = None
|
||||
|
|
|
@ -84,7 +84,6 @@ def request_api_keys(v):
|
|||
notif = Notification(comment_id=new_comment.id, user_id=admin_id)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.flush()
|
||||
push_notif(admin_ids, 'New notification', new_comment.body, f'{SITE_FULL}/comment/{new_comment.id}?read=true#context')
|
||||
|
||||
return redirect('/settings/apps')
|
||||
|
|
|
@ -258,7 +258,6 @@ def submit_contact(v):
|
|||
notif = Notification(comment_id=new_comment.id, user_id=admin_id)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.flush()
|
||||
push_notif(admin_ids, f'New modmail from @{v.username}', new_comment.body, f'{SITE_FULL}/notifications/modmail')
|
||||
|
||||
return redirect("/contact?msg=Your message has been sent to the admins!")
|
||||
|
|
Loading…
Reference in New Issue