diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 84cca0da9..72eebfbc0 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -99,7 +99,8 @@ def send_admin(id, body_html, vid): g.db.add(new_comment) g.db.flush() - admins = g.db.query(User).filter(User.admin_level > 2, User.id != vid).all() + if vid: admins = g.db.query(User).filter(User.admin_level > 2, User.id != vid).all() + else: admins = g.db.query(User).filter(User.admin_level > 2).all() for admin in admins: notif = Notification(comment_id=new_comment.id, user_id=admin.id) g.db.add(notif) \ No newline at end of file diff --git a/files/routes/oauth.py b/files/routes/oauth.py index 815842b44..e9bc3972d 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -48,11 +48,11 @@ def request_api_keys(v): g.db.add(new_app) - text = f"{v.username} has requested API keys for `{request.values.get('name')}`. You can approve or deny the request [here](/admin/apps)." + body = f"{v.username} has requested API keys for `{request.values.get('name')}`. You can approve or deny the request [here](/admin/apps)." - text_html = sanitize(text, noimages=True) + body_html = sanitize(body, noimages=True) - send_admin(NOTIFICATIONS_ID, text_html, v.id) + send_admin(NOTIFICATIONS_ID, body_html) g.db.commit() diff --git a/files/routes/static.py b/files/routes/static.py index 9a21c2d29..646bcbd87 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -295,7 +295,7 @@ def submit_contact(v): body_html += f"

{url}

" else: return {"error": "Image/Video files only"}, 400 - send_admin(v.id, body_html, v.id) + send_admin(v.id, body_html) g.db.commit() return render_template("contact.html", v=v, msg="Your message has been sent.")