Skip to content

Commit

Permalink
Fix ban checkbox being passed into ban payload
Browse files Browse the repository at this point in the history
  • Loading branch information
raccube committed Jan 2, 2022
1 parent b196cbd commit b249e40
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/javascript/legacy/moderation/ban.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,13 @@ load = ->
modalForm.addEventListener "submit", (event) ->
event.preventDefault();

checktostr = (el) ->
if el.checked
"1"
else
"0"

data = {
ban: banCheckbox ? checktostr banCheckbox : false
ban: "0"
user: modalForm.elements["user"].value
}

if banCheckbox && banCheckbox.checked
data.ban = "1"
data.reason = modalForm.elements["reason"].value.trim()
unless permabanCheckbox.checked
data.duration = modalForm.elements["duration"].value.trim()
Expand Down

0 comments on commit b249e40

Please sign in to comment.