remotes/1693045480750635534/spooky-22
Aevann1 2022-02-01 01:55:11 +02:00
parent 26bfdd4f33
commit eeaa824b27
6 changed files with 28 additions and 16 deletions

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<script src="/static/assets/js/award_modal.js?a=221"></script>
<div class="modal fade" id="awardModal" tabindex="-1" role="dialog" aria-labelledby="awardModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered awardmodal" role="document">
<div class="modal-content pb-4">
<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered awardmodal my-5" role="document">
<div class="modal-content pb-5">
<div class="modal-header">
<h5 class="modal-title">Give Award</h5>
<button role="button" class="close" data-bs-dismiss="modal" aria-label="Close">
@ -77,14 +77,11 @@
column-count: 1;
}
@media (min-width: 767.98px) {
.award-columns {
column-count: 7 !important;
}
}
.awardmodal {
max-width: 90% !important;
min-height: 90% !important;
max-height: 90% !important;
height: 90% !important;
}
toast {

View File

@ -915,7 +915,7 @@
{% include "expanded_image_modal.html" %}
<script src="/static/assets/js/comments+submission_listing.js?a=221"></script>
<script src="/static/assets/js/comments+submission_listing.js?a=222"></script>
<script src="/static/assets/js/comments.js?a=221"></script>
<script>

View File

@ -680,5 +680,5 @@
</style>
<script src="/static/assets/js/clipboard.js?a=220"></script>
<script src="/static/assets/js/comments+submission_listing.js?a=221"></script>
<script src="/static/assets/js/comments+submission_listing.js?a=222"></script>
<script src="/static/assets/js/submission_listing.js?a=221"></script>

View File

@ -241,7 +241,7 @@
<form action="/ban_user/{{u.id}}" method="post" action="">
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" type="hidden" name="redir" value="true">
<input autocomplete="off" style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit').disabled=false">
<input autocomplete="off" style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit').disabled=false">
<input autocomplete="off" style="font-size:11px;" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" id="alts-2-desktop" class="custom-control-input" name="alts" value="1">
@ -524,7 +524,7 @@
<form action="/ban_user/{{u.id}}/" method="post">
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" type="hidden" name="redir" value="true">
<input autocomplete="off" style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit2').disabled=false">
<input autocomplete="off" style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit2').disabled=false">
<input autocomplete="off" style="font-size:11px;" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
<br >
<div class="custom-control custom-checkbox">