master
Aevann1 2022-02-01 02:03:39 +02:00
parent 3ebfd49d57
commit 59027a7276
4 changed files with 6 additions and 6 deletions

View File

@ -88,7 +88,7 @@ def NOTIFY_USERS2(text, v):
return notify_users return notify_users
def send_admin(id, body_html): def send_admin(id, body_html, vid):
new_comment = Comment(author_id=id, new_comment = Comment(author_id=id,
parent_submission=None, parent_submission=None,
@ -99,7 +99,7 @@ def send_admin(id, body_html):
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).all() admins = g.db.query(User).filter(User.admin_level > 2, User.id != vid).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)

View File

@ -765,7 +765,7 @@ def shadowban(user_id, v):
body_html = sanitize(body) body_html = sanitize(body)
send_admin(NOTIFICATIONS_ID, body_html) send_admin(NOTIFICATIONS_ID, body_html, v.id)
g.db.commit() g.db.commit()
return {"message": "User shadowbanned!"} return {"message": "User shadowbanned!"}
@ -930,7 +930,7 @@ def ban_user(user_id, v):
body_html = sanitize(body) body_html = sanitize(body)
send_admin(NOTIFICATIONS_ID, body_html) send_admin(NOTIFICATIONS_ID, body_html, v.id)
g.db.commit() g.db.commit()

View File

@ -52,7 +52,7 @@ def request_api_keys(v):
text_html = sanitize(text, noimages=True) text_html = sanitize(text, noimages=True)
send_admin(NOTIFICATIONS_ID, text_html) send_admin(NOTIFICATIONS_ID, text_html, v.id)
g.db.commit() g.db.commit()

View File

@ -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) send_admin(v.id, body_html, v.id)
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.")