From ad63fca3e7374c0294170dc7256f03980f019791 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 24 Feb 2023 03:58:52 +0200 Subject: [PATCH] giev push notif for app requests --- files/routes/oauth.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/files/routes/oauth.py b/files/routes/oauth.py index 9e23caedf..e9b674bdc 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -78,11 +78,14 @@ def request_api_keys(v): new_comment.top_comment_id = new_comment.id - for admin in g.db.query(User).filter(User.admin_level >= PERMS['APPS_MODERATION']).all(): - notif = Notification(comment_id=new_comment.id, user_id=admin.id) + admin_ids = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['APPS_MODERATION']).all()] + + for admin_id in admin_ids: + 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')