Fix ban checkbox being passed into ban payload

This commit is contained in:
Karina Kwiatek 2021-12-31 00:17:09 +01:00
parent b196cbdd1c
commit b249e40273
1 changed files with 2 additions and 7 deletions

View File

@ -23,18 +23,13 @@ load = ->
modalForm.addEventListener "submit", (event) -> modalForm.addEventListener "submit", (event) ->
event.preventDefault(); event.preventDefault();
checktostr = (el) ->
if el.checked
"1"
else
"0"
data = { data = {
ban: banCheckbox ? checktostr banCheckbox : false ban: "0"
user: modalForm.elements["user"].value user: modalForm.elements["user"].value
} }
if banCheckbox && banCheckbox.checked if banCheckbox && banCheckbox.checked
data.ban = "1"
data.reason = modalForm.elements["reason"].value.trim() data.reason = modalForm.elements["reason"].value.trim()
unless permabanCheckbox.checked unless permabanCheckbox.checked
data.duration = modalForm.elements["duration"].value.trim() data.duration = modalForm.elements["duration"].value.trim()