fix approving/removing hats with `(` in name

pull/199/head
Aevann 2023-09-17 23:32:41 +03:00
parent 89e0d49b38
commit 13e83143fd
2 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,5 @@
function approve_hat(t, name) {
console.log(name)
console.log(`${name}-description`)
function approve_hat(t) {
const name = t.dataset.name
postToast(t, `/admin/approve/hat/${name}`,
{
"description": document.getElementById(`${name}-description`).value,
@ -13,7 +12,8 @@ function approve_hat(t, name) {
);
}
function remove_hat(t, name) {
function remove_hat(t) {
const name = t.dataset.name
postToast(t, `/remove/hat/${name}`,
{
},

View File

@ -82,9 +82,9 @@
</div>
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] or v.id == hat.submitter_id %}
<div class="d-flex my-4 mx-3">
<button type="button" class="btn btn-danger ml-auto" data-nonce="{{g.nonce}}" data-onclick="remove_hat(this, '{{hat.name}}')">Remove</button>
<button type="button" class="btn btn-danger ml-auto" data-nonce="{{g.nonce}}" data-onclick="remove_hat(this)" data-name="{{hat.name}}">Remove</button>
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}
<button type="button" class="btn btn-success ml-3" data-nonce="{{g.nonce}}" data-onclick="approve_hat(this, '{{hat.name}}')">Approve</button>
<button type="button" class="btn btn-success ml-3" data-nonce="{{g.nonce}}" data-onclick="approve_hat(this)" data-name="{{hat.name}}">Approve</button>
{% endif %}
</div>
{% endif %}