refactor banning and chudding on posts/comments

pull/142/head
Aevann 2023-03-17 16:37:13 +02:00
parent f66fcdc6ce
commit 2cf2d869de
10 changed files with 119 additions and 131 deletions

View File

@ -0,0 +1,32 @@
function punishModal(t, kind, link, name, fullname) {
const kind_title = kind.charAt(0).toUpperCase() + kind.slice(1)
document.getElementById(`${kind}ModalTitle`).innerHTML = `${kind_title} @${name}`;
document.getElementById(`${kind}_reason`).value = link;
const btn = document.getElementById(`${kind}UserButton`)
btn.innerHTML = `${kind_title} @${name}`;
btn.onclick = () => {
const values = {
"days": document.getElementById(`${kind}_days`).value,
"reason": document.getElementById(`${kind}_reason`).value
}
if (kind == "ban") {
values["alts"] = document.getElementById(`${kind}_alts`).value;
}
postToast(t, `/${kind}_user/${fullname}`,
values,
() => {
document.getElementById(`un${kind}-${fullname}`).classList.remove("d-none");
document.getElementById(`un${kind}2-${fullname}`).classList.remove("d-none");
const days = document.getElementById(`${kind}_days`).value
if (!days) {
t.classList.add("d-none")
}
}
);
}
}

View File

@ -1,43 +0,0 @@
function banModal(link, name, fullname, cls) {
document.getElementById("banModalTitle").innerHTML = `Ban @${name}`;
document.getElementById("ban-modal-link").value = link;
document.getElementById("banUserButton").innerHTML = `Ban @${name}`;
document.getElementById("banUserButton").addEventListener('click', function() {
let form = new FormData(document.getElementById("banModalForm"));
const xhr = createXhrWithFormKey(`/ban_user/${fullname}?form`, "POST", form);
xhr[0].onload = function() {
let data
try {data = JSON.parse(xhr[0].response)}
catch(e) {console.error(e)}
success = xhr[0].status >= 200 && xhr[0].status < 300;
showToast(success, getMessageFromJsonData(success, data));
document.getElementById(`unban-${fullname}`).classList.toggle(cls);
document.getElementById(`unban2-${fullname}`).classList.toggle(cls);
};
xhr[0].send(xhr[1]);
})
}
function chudModal(link, name, fullname, cls) {
document.getElementById("chudModalTitle").innerHTML = `Chud @${name}`;
document.getElementById("chud-modal-link").value = link;
document.getElementById("chudUserButton").innerHTML = `Chud @${name}`;
document.getElementById("chudUserButton").addEventListener('click', function() {
let form = new FormData(document.getElementById("chudModalForm"));
const xhr = createXhrWithFormKey(`/agendaposter/${fullname}?form`, "POST", form);
xhr[0].onload = function() {
let data
try {data = JSON.parse(xhr[0].response)}
catch(e) {console.error(e)}
success = xhr[0].status >= 200 && xhr[0].status < 300;
showToast(success, getMessageFromJsonData(success, data));
document.getElementById(`unchud-${fullname}`).classList.toggle(cls);
document.getElementById(`unchud2-${fullname}`).classList.toggle(cls);
};
xhr[0].send(xhr[1]);
})
}

View File

@ -751,7 +751,7 @@ def admin_removed_comments(v):
next_exists=next_exists
)
@app.post("/unagendaposter/<id>")
@app.post("/unchud_user/<id>")
@limiter.limit('1/second', scope=rpath)
@limiter.limit(DEFAULT_RATELIMIT)
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@ -995,7 +995,7 @@ def ban_user(id, v):
return {"message": f"@{user.username} has been banned {duration}!"}
@app.post("/agendaposter/<id>")
@app.post("/chud_user/<id>")
@limiter.limit('1/second', scope=rpath)
@limiter.limit(DEFAULT_RATELIMIT)
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)

View File

@ -480,13 +480,15 @@
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %}
<button type="button" id="unban-{{c.fullname}}" class="dropdown-item list-inline-item d-none {% if c.author.is_suspended %}d-md-block{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unban_user/{{c.fullname}}','ban-{{c.fullname}}','unban-{{c.fullname}}','d-md-block')"><i class="fas fa-user-slash text-success fa-fw"></i>Unban user</button>
<button type="button" class="dropdown-item list-inline-item d-none d-md-block text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="banModal('/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}','d-md-block')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
<button type="button" id="unban-{{c.fullname}}" class="dropdown-item list-inline-item d-mob-none {% if not c.author.is_suspended %}d-none{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')"><i class="fas fa-user-slash text-success fa-fw"></i>Unban user</button>
<button type="button" class="{% if c.author.is_suspended_permanently %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
{% endif %}
{% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] and v.id != c.author_id %}
<button type="button" id="unchud-{{c.fullname}}" class="dropdown-item list-inline-item d-none {% if c.author.agendaposter %}d-md-block{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unagendaposter/{{c.fullname}}','chud-{{c.fullname}}','unchud-{{c.fullname}}','d-md-block')"><i class="fas fa-face-sleeping text-success fa-fw"></i>Unchud user</button>
<button type="button" class="dropdown-item list-inline-item d-none d-md-block text-danger" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="chudModal('/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}','d-md-block')"><i class="fas fa-face-sleeping text-danger fa-fw"></i>Chud user</button>
<button type="button" id="unchud-{{c.fullname}}" class="dropdown-item list-inline-item d-mob-none {% if not c.author.agendaposter %}d-none{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{c.fullname}}')"><i class="fas fa-face-sleeping text-success fa-fw"></i>Unchud user</button>
<button type="button" class="{% if c.author.agendaposter == 1 %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-face-sleeping text-danger fa-fw"></i>Chud user</button>
{% endif %}
</ul>
@ -693,13 +695,15 @@
{% endif %}
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_BAN'] %}
<button type="button" class="list-group-item text-danger" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="banModal('/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}','d-none')"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</button>
<button type="button" id="unban2-{{c.fullname}}" class="{% if not c.author.is_banned %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unban_user/{{c.fullname}}','ban2-{{c.fullname}}','unban2-{{c.fullname}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-user-minus fa-fw text-success mr-2"></i>Unban user</button>
<button type="button" id="unban2-{{c.fullname}}" class="{% if not c.author.is_suspended %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus fa-fw text-success mr-2"></i>Unban user</button>
<button type="button" class="list-group-item text-danger {% if c.author.is_suspended_permanently %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</button>
{% endif %}
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}
<button type="button" class="list-group-item text-danger" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="chudModal('/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}','d-none')"><i class="fas fa-face-sleeping text-danger fa-fw mr-2"></i>Chud user</button>
<button type="button" id="unchud2-{{c.fullname}}" class="{% if not c.author.agendaposter %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unagendaposter/{{c.fullname}}','chud2-{{c.fullname}}','unchud2-{{c.fullname}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-face-sleeping fa-fw text-success mr-2"></i>Unchud user</button>
<button type="button" id="unchud2-{{c.fullname}}" class="{% if not c.author.agendaposter %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{c.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-face-sleeping fa-fw text-success mr-2"></i>Unchud user</button>
<button type="button" class="list-group-item text-danger {% if c.author.agendaposter == 1 %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/comment/{{c.id}}', '{{c.author_name}}', '{{c.fullname}}')"><i class="fas fa-face-sleeping text-danger fa-fw mr-2"></i>Chud user</button>
{% endif %}
{% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
@ -728,7 +732,7 @@
{% include "modals/gif.html" %}
{% include "modals/emoji.html" %}
{% if v.admin_level >= PERMS['USER_BAN'] %}
{% include "modals/ban.html" %}
{% include "modals/punish.html" %}
{% endif %}
<div class="modal fade" id="deleteCommentModal" tabindex="-1">

View File

@ -1,66 +0,0 @@
<div class="modal fade" id="banModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header pt-3">
<h5 id="banModalTitle"></h5>
<button type="button" class="close" data-bs-dismiss="modal">
<span><i class="far fa-times"></i></span>
</button>
</div>
<div class="modal-body" id="ban-modal-body">
<form id="banModalForm">
<input hidden name="formkey" value="{{v|formkey}}">
<label for="ban-modal-link">Public ban reason (optional)</label>
<input autocomplete="off" name="reason" id="ban-modal-link" class="form-control" placeholder="Enter reason" maxlength="256">
<label for="days" class="mt-3">Days</label>
<input autocomplete="off" type="number" step="any" name="days" max="{{max_days()}}" id="days" class="form-control" placeholder="Leave blank for permanent">
<div class="custom-control custom-switch mt-3">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="alts" name="alts">
<label class="custom-control-label" for="alts">Ban known alts</label>
</div>
<div class="modal-footer pr-0">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<button type="button" id="banUserButton" class="btn btn-danger btn-primary mr-0" data-bs-dismiss="modal"></button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="chudModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header pt-3">
<h5 id="chudModalTitle"></h5>
<button type="button" class="close" data-bs-dismiss="modal">
<span><i class="far fa-times"></i></span>
</button>
</div>
<div class="modal-body pt-0" id="chud-modal-body">
<form id="chudModalForm">
<input hidden name="formkey" value="{{v|formkey}}">
<input hidden name="reason" id="chud-modal-link">
<label for="days">Days</label>
<input autocomplete="off" type="number" step="any" name="days" max="{{max_days()}}" id="days" class="form-control" placeholder="Leave blank for permanent">
<div class="modal-footer pr-0">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<button type="button" id="chudUserButton" class="btn btn-danger btn-primary mr-0" data-bs-dismiss="modal"></button>
</div>
</form>
</div>
</div>
</div>
</div>
<script defer src="{{'js/ban_modal.js' | asset}}"></script>

View File

@ -0,0 +1,57 @@
<div class="modal fade" id="banModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header pt-3">
<h5 id="banModalTitle"></h5>
<button type="button" class="close" data-bs-dismiss="modal">
<span><i class="far fa-times"></i></span>
</button>
</div>
<div class="modal-body" id="ban-modal-body">
<label for="ban_reason">Public ban reason (optional)</label>
<input autocomplete="off" name="reason" id="ban_reason" class="form-control" placeholder="Enter reason" maxlength="256">
<label for="days" class="mt-3">Days</label>
<input autocomplete="off" type="number" step="any" name="days" max="{{max_days()}}" id="ban_days" class="form-control" placeholder="Leave blank for permanent">
<div class="custom-control custom-switch mt-3">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="ban_alts" name="alts">
<label class="custom-control-label" for="ban_alts">Ban known alts</label>
</div>
<div class="modal-footer pr-0">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<button type="button" id="banUserButton" class="btn btn-danger btn-primary mr-0" data-bs-dismiss="modal"></button>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="chudModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header pt-3">
<h5 id="chudModalTitle"></h5>
<button type="button" class="close" data-bs-dismiss="modal">
<span><i class="far fa-times"></i></span>
</button>
</div>
<div class="modal-body pt-0" id="chud-modal-body">
<input id="chud_reason" hidden name="reason" id="chud_reason">
<label for="days">Days</label>
<input autocomplete="off" type="number" step="any" name="days" max="{{max_days()}}" id="chud_days" class="form-control" placeholder="Leave blank for permanent">
<div class="modal-footer pr-0">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
<button type="button" id="chudUserButton" class="btn btn-danger btn-primary mr-0" data-bs-dismiss="modal"></button>
</div>
</div>
</div>
</div>
</div>
<script defer src="{{'js/admin/punish_modal.js' | asset}}"></script>

View File

@ -87,12 +87,14 @@
<button type="button" id="unprogstack-{{p.id}}" class="dropdown-item {% if p.is_approved != PROGSTACK_ID %}d-none{% endif %} list-inline-item text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/admin/unprogstack/post/{{p.id}}','progstack-{{p.id}}','unprogstack-{{p.id}}','d-none')"><i class="fas fa-bullhorn"></i>Remove Progressive Stack</button>
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != p.author_id %}
<button type="button" class="dropdown-item list-inline-item text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="banModal('/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}','d-none')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
<button type="button" id="unban-{{p.fullname}}" class="dropdown-item {% if not p.author.is_suspended %}d-none{% endif %} list-inline-item text-success" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unban_user/{{p.fullname}}','ban-{{p.fullname}}','unban-{{p.fullname}}','d-none')"><i class="fas fa-user-slash"></i>Unban user</button>
<button type="button" id="unban-{{p.fullname}}" class="dropdown-item {% if not p.author.is_suspended %}d-none{% endif %} list-inline-item text-success {% if p.author.is_suspended_permanently %}d-none{% endif %}" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')"><i class="fas fa-user-slash"></i>Unban user</button>
<button type="button" class="dropdown-item list-inline-item text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
{% endif %}
{% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] and v.id != p.author_id %}
<button type="button" class="dropdown-item list-inline-item text-danger" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="chudModal('/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}','d-none')"><i class="fas fa-face-sleeping text-danger fa-fw"></i>Chud user</button>
<button type="button" id="unchud-{{p.fullname}}" class="dropdown-item {% if not p.author.agendaposter %}d-none{% endif %} list-inline-item text-success" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unagendaposter/{{p.fullname}}','chud-{{p.fullname}}','unchud-{{p.fullname}}','d-none')"><i class="fas fa-face-sleeping"></i>Unchud user</button>
<button type="button" id="unchud-{{p.fullname}}" class="dropdown-item {% if not p.author.agendaposter %}d-none{% endif %} list-inline-item text-success" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{p.fullname}}')"><i class="fas fa-face-sleeping"></i>Unchud user</button>
<button type="button" class="dropdown-item list-inline-item text-danger {% if p.author.agendaposter == 1 %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')"><i class="fas fa-face-sleeping text-danger fa-fw"></i>Chud user</button>
{% endif %}
</ul>
{% endif %}

View File

@ -41,12 +41,14 @@
<button type="button" id="unprogstack2-{{p.id}}" class="{% if p.is_approved != PROGSTACK_ID %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/admin/unprogstack/post/{{p.id}}','progstack2-{{p.id}}','unprogstack2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-bullhorn text-center text-danger mr-2"></i>Remove Progressive Stack</button>
{% endif %}
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_BAN'] %}
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="banModal('/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}','d-none')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left"><i class="fas fa-user-minus mr-2"></i>Ban user</button>
<button type="button" id="unban2-{{p.fullname}}" class="{% if not p.author.is_suspended %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unban_user/{{p.fullname}}','ban2-{{p.fullname}}','unban2-{{p.fullname}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-user-minus mr-2"></i>Unban user</button>
<button type="button" id="unban2-{{p.fullname}}" class="{% if not p.author.is_suspended %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus mr-2"></i>Unban user</button>
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.is_suspended_permanently %}d-none{% endif %}"><i class="fas fa-user-minus mr-2"></i>Ban user</button>
{% endif %}
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="chudModal('/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}','d-none')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left"><i class="fas fa-face-sleeping mr-2"></i>Chud user</button>
<button type="button" id="unchud2-{{p.fullname}}" class="{% if not p.author.agendaposter %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unagendaposter/{{p.fullname}}','chud2-{{p.fullname}}','unchud2-{{p.fullname}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-face-sleeping mr-2"></i>Unchud user</button>
<button type="button" id="unchud2-{{p.fullname}}" class="{% if not p.author.agendaposter %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{p.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-face-sleeping mr-2"></i>Unchud user</button>
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#chudModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'chud', '/post/{{p.id}}', '{{p.author_name}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.agendaposter == 1 %}d-none{% endif %}"><i class="fas fa-face-sleeping mr-2"></i>Chud user</button>
{% endif %}
</ul>
</div>

View File

@ -284,7 +284,7 @@
{% include "modals/delete_post.html" %}
{% include "modals/report_post.html" %}
{% if v.admin_level >= PERMS['USER_BAN'] %}
{% include "modals/ban.html" %}
{% include "modals/punish.html" %}
{% endif %}
{% endif %}

View File

@ -65,9 +65,9 @@
</form>
{% endif %}
{% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}
<button type="button" id="unagendaposter-{{deviceType}}" class="mt-1 {% if not u.agendaposter %}d-none{% endif %} btn btn-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unagendaposter/{{u.id}}')">Unchud</button>
<button type="button" id="unagendaposter-{{deviceType}}" class="mt-1 {% if not u.agendaposter %}d-none{% endif %} btn btn-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unchud_user/{{u.id}}')">Unchud</button>
<form class="my-3 {% if u.agendaposter == 1 %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
<form class="my-3 {% if u.agendaposter == 1 %}d-none{% endif %}" action="/chud_user/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
<input hidden name="formkey" value="{{v|formkey}}">
<input autocomplete="off" type="number" step="any" name="days" max="{{max_days()}}" class="form-control" placeholder="Days (0 or blank = permanent)">
<input type="submit" class="btn btn-danger" value="Chud">