Adjust ban script to work when unbanning
This commit is contained in:
parent
374da66cd1
commit
b196cbdd1c
|
@ -6,6 +6,7 @@ load = ->
|
|||
banCheckbox = modalForm.querySelector('[name="ban"][type="checkbox"]')
|
||||
permabanCheckbox = modalForm.querySelector('[name="permaban"][type="checkbox"]')
|
||||
|
||||
if banCheckbox
|
||||
banCheckbox.addEventListener "change", (event) ->
|
||||
$t = $ this
|
||||
if $t.is(":checked")
|
||||
|
@ -29,11 +30,11 @@ load = ->
|
|||
"0"
|
||||
|
||||
data = {
|
||||
ban: checktostr banCheckbox
|
||||
ban: banCheckbox ? checktostr banCheckbox : false
|
||||
user: modalForm.elements["user"].value
|
||||
}
|
||||
|
||||
if banCheckbox.checked
|
||||
if banCheckbox && banCheckbox.checked
|
||||
data.reason = modalForm.elements["reason"].value.trim()
|
||||
unless permabanCheckbox.checked
|
||||
data.duration = modalForm.elements["duration"].value.trim()
|
||||
|
|
Loading…
Reference in New Issue