This commit is contained in:
Aevann1 2022-02-21 03:58:12 +02:00
parent 5d47158e5f
commit 661bc9f045
6 changed files with 57 additions and 26 deletions

View file

@ -883,7 +883,19 @@ def shadowban(user_id, v):
body_html = sanitize(body)
send_admin(NOTIFICATIONS_ID, body_html, v.id)
new_comment = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=None,
level=1,
body_html=body_html,
)
g.db.add(new_comment)
g.db.flush()
for admin in g.db.query(User).filter(User.admin_level > 2, User.id != v.id).all():
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
g.db.add(notif)
g.db.commit()
return {"message": "User shadowbanned!"}
@ -1052,7 +1064,18 @@ def ban_user(user_id, v):
body_html = sanitize(body)
send_admin(NOTIFICATIONS_ID, body_html, v.id)
new_comment = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=None,
level=1,
body_html=body_html,
)
g.db.add(new_comment)
g.db.flush()
for admin in g.db.query(User).filter(User.admin_level > 2, User.id != v.id).all():
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
g.db.add(notif)
g.db.commit()