master
Aevann1 2022-02-01 02:07:15 +02:00
parent 59027a7276
commit 50a7cfc0c1
3 changed files with 6 additions and 5 deletions

View File

@ -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)

View File

@ -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()

View File

@ -295,7 +295,7 @@ def submit_contact(v):
body_html += f"<p>{url}</p>"
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.")