xvc
This commit is contained in:
parent
f907260ab2
commit
76c72b501b
3 changed files with 6 additions and 5 deletions
|
@ -99,7 +99,8 @@ def send_admin(id, body_html, vid):
|
||||||
g.db.add(new_comment)
|
g.db.add(new_comment)
|
||||||
g.db.flush()
|
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:
|
for admin in admins:
|
||||||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
|
@ -48,11 +48,11 @@ def request_api_keys(v):
|
||||||
|
|
||||||
g.db.add(new_app)
|
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()
|
g.db.commit()
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ def submit_contact(v):
|
||||||
body_html += f"<p>{url}</p>"
|
body_html += f"<p>{url}</p>"
|
||||||
else: return {"error": "Image/Video files only"}, 400
|
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()
|
g.db.commit()
|
||||||
return render_template("contact.html", v=v, msg="Your message has been sent.")
|
return render_template("contact.html", v=v, msg="Your message has been sent.")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue