From eeaa824b27c6da93e4a35718e2ef213294bb5859 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 1 Feb 2022 01:55:11 +0200 Subject: [PATCH] gf4 --- files/routes/admin.py | 21 ++++++++++++++++++--- files/routes/settings.py | 2 +- files/templates/award_modal.html | 13 +++++-------- files/templates/comments.html | 2 +- files/templates/submission_listing.html | 2 +- files/templates/userpage.html | 4 ++-- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 40326a552..52aae2b3b 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -761,6 +761,12 @@ def shadowban(user_id, v): cache.delete_memoized(frontlist) + body = f"@{v.username} has shadowbanned @{user.username}" + + body_html = sanitize(body) + + send_admin(NOTIFICATIONS_ID, body_html) + g.db.commit() return {"message": "User shadowbanned!"} @@ -897,11 +903,13 @@ def ban_user(user_id, v): if days == 0: duration = "permanent" elif days == 1: duration = "1 day" else: duration = f"{days} days" + + note = f'reason: "{reason}", duration: {duration}' ma=ModAction( kind="ban_user", user_id=v.id, target_user_id=user.id, - _note=f'reason: "{reason}", duration: {duration}' + _note=note ) g.db.add(ma) @@ -916,6 +924,14 @@ def ban_user(user_id, v): comment = get_comment(comment) comment.bannedfor = True g.db.add(comment) + + + body = f"@{v.username} has banned @{user.username} ({note})" + + body_html = sanitize(body) + + send_admin(NOTIFICATIONS_ID, body_html) + g.db.commit() if 'redir' in request.values: return redirect(user.url) @@ -929,8 +945,7 @@ def unban_user(user_id, v): user = g.db.query(User).filter_by(id=user_id).one_or_none() - if not user: - abort(400) + if not user: abort(400) user.is_banned = 0 user.unban_utc = 0 diff --git a/files/routes/settings.py b/files/routes/settings.py index 1a3618231..128c935b6 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -751,7 +751,7 @@ def settings_profilecss(v): return render_template("settings_profilecss.html", v=v) @app.post("/settings/block") -@limiter.limit("1/second;30/minute;200/hour;1000/day") +@limiter.limit("1/second;10/day") @auth_required def settings_block_user(v): diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 73b8563ca..ac43f9193 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -1,7 +1,7 @@