make "unban user" button in userpage work instantly

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-11-05 04:07:29 +02:00
parent 5ef2b41d5e
commit ab9c0288fb
2 changed files with 14 additions and 21 deletions

View File

@ -1062,8 +1062,7 @@ def unban_user(user_id, v):
)
g.db.add(ma)
if "@" in request.referrer: return redirect(user.url)
else: return {"message": f"@{user.username} has been unbanned!"}
return {"message": f"@{user.username} has been unbanned!"}
@app.post("/mute_user/<int:user_id>/<int:mute_status>")
@limiter.limit("1/second;30/minute;200/hour;1000/day")

View File

@ -42,14 +42,9 @@
</div>
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] %}
{% if u.is_suspended %}
<form class="mb-2" action="/unban_user/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Unban user">
</form>
{% else %}
<form class="mb-2" action="/ban_user/{{u.id}}" method="post">
<button type="button" id="unban-{{deviceType}}" class="mt-1 mb-3 {% if not u.is_suspended %}d-none{% endif %} btn btn-success" onclick="postToastSwitch(this,'/unban_user/{{u.id}}','ban-{{deviceType}}','unban-{{deviceType}}','d-none')">Unban user</button>
<form id="ban-{{deviceType}}" class="mb-3 {% if u.is_suspended %}d-none{% endif %}" action="/ban_user/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit-{{deviceType}}').disabled=false" required>
@ -61,7 +56,6 @@
<input autocomplete="off" id="user-ban-submit-{{deviceType}}" type="submit" onclick="disable(this)" class="btn btn-danger" value="Ban user" disabled>
</form>
{% endif %}
{% endif %}
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
{% if u.shadowbanned %}
<form class="mb-2" action="/unshadowban/{{u.id}}" method="post">