forked from rDrama/rDrama
make "unshadowban" button work instantly
parent
81ed8cfc81
commit
f924f88821
|
@ -839,7 +839,8 @@ def unagendaposter(user_id, v):
|
||||||
@admin_level_required(PERMS['USER_SHADOWBAN'])
|
@admin_level_required(PERMS['USER_SHADOWBAN'])
|
||||||
def shadowban(user_id, v):
|
def shadowban(user_id, v):
|
||||||
user = get_account(user_id)
|
user = get_account(user_id)
|
||||||
if user.admin_level != 0: abort(403)
|
if user.admin_level > v.admin_level:
|
||||||
|
abort(403)
|
||||||
user.shadowbanned = v.username
|
user.shadowbanned = v.username
|
||||||
reason = request.values.get("reason").strip()[:256]
|
reason = request.values.get("reason").strip()[:256]
|
||||||
user.ban_reason = reason
|
user.ban_reason = reason
|
||||||
|
@ -886,7 +887,7 @@ def unshadowban(user_id, v):
|
||||||
|
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
|
|
||||||
return redirect(user.url)
|
return {"message": f"@{user.username} has been unshadowbanned!"}
|
||||||
|
|
||||||
|
|
||||||
@app.post("/admin/title_change/<user_id>")
|
@app.post("/admin/title_change/<user_id>")
|
||||||
|
|
|
@ -57,13 +57,9 @@
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
|
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
|
||||||
{% if u.shadowbanned %}
|
<button type="button" id="unshadowban-{{deviceType}}" class="mt-1 mb-3 {% if not u.shadowbanned %}d-none{% endif %} btn btn-success" onclick="postToastSwitch(this,'/unshadowban/{{u.id}}','shadowban-{{deviceType}}','unshadowban-{{deviceType}}','d-none')">Unshadowban user</button>
|
||||||
<form class="mb-3" action="/unshadowban/{{u.id}}" method="post">
|
|
||||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
<form id="shadowban-{{deviceType}}" class="mb-3 {% if u.shadowbanned %}d-none{% endif %}" action="/shadowban/{{u.id}}" method="post">
|
||||||
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Unshadowban user">
|
|
||||||
</form>
|
|
||||||
{% else %}
|
|
||||||
<form class="mb-3" action="/shadowban/{{u.id}}" method="post">
|
|
||||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||||
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Shadowban Reason" oninput="document.getElementById('user-shadowban-submit-{{deviceType}}').disabled=false" required>
|
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Shadowban Reason" oninput="document.getElementById('user-shadowban-submit-{{deviceType}}').disabled=false" required>
|
||||||
<div class="custom-control custom-checkbox mb-1">
|
<div class="custom-control custom-checkbox mb-1">
|
||||||
|
@ -73,7 +69,6 @@
|
||||||
<input autocomplete="off" id="user-shadowban-submit-{{deviceType}}" type="submit" onclick="disable(this)" class="btn btn-danger" value="Shadowban user" disabled>
|
<input autocomplete="off" id="user-shadowban-submit-{{deviceType}}" type="submit" onclick="disable(this)" class="btn btn-danger" value="Shadowban user" disabled>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
{% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}
|
{% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}
|
||||||
<form id="agendaposter-{{deviceType}}" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
<form id="agendaposter-{{deviceType}}" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
||||||
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
||||||
|
|
Loading…
Reference in New Issue