Skip to content

Commit

Permalink
Merge pull request #1183 from codidact/0valt/privilege-edit-fix
Browse files Browse the repository at this point in the history
Fix not being able to edit privilege thresholds to 0 from the admin panel
  • Loading branch information
cellio authored Aug 22, 2023
2 parents 66cb7a9 + 8400a35 commit 566683e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/assets/javascripts/privileges.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ $(() => {
const $input = $td.find('.js-privilege-edit');
const name = $input.data('name');
const type = $input.data('type');
const value = parseFloat($input.val() || '') || null;

// incorrect input values will cause rawValue to be NaN
const rawValue = parseFloat($input.val())

const value = Number.isNaN(rawValue) ? null : rawValue;

const resp = await fetch(`/admin/privileges/${name}`, {
method: 'POST',
Expand Down

0 comments on commit 566683e

Please sign in to comment.