diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-07-04 16:13:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-04 16:13:18 +0200 |
commit | a48df671a3cc7c9a02b14e26f6ee9c2cf2304061 (patch) | |
tree | 387158046d1bb7521964bf5f268b0fe60d3e1ecf /settings | |
parent | 8d866dfba447ebfddd921d4393ee099451b9731d (diff) | |
parent | 0501d8daacde4a67610210f2543d24c462d9098c (diff) | |
download | nextcloud-server-a48df671a3cc7c9a02b14e26f6ee9c2cf2304061.tar.gz nextcloud-server-a48df671a3cc7c9a02b14e26f6ee9c2cf2304061.zip |
Merge pull request #25253 from owncloud/users-fixotherquotadropdown
Fix "Other" value handling in quota dropdown in users page
Diffstat (limited to 'settings')
-rw-r--r-- | settings/js/users/users.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js index e0fccbd9539..2524a1da0bb 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -138,10 +138,13 @@ var UserList = { .find('option').attr('selected', null) .first().attr('selected', 'selected'); } else { - if ($quotaSelect.find('option').filterAttr('value', user.quota).length > 0) { - $quotaSelect.find('option').filterAttr('value', user.quota).attr('selected', 'selected'); + var $options = $quotaSelect.find('option'); + var $foundOption = $options.filterAttr('value', user.quota); + if ($foundOption.length > 0) { + $foundOption.attr('selected', 'selected'); } else { - $quotaSelect.append('<option value="' + escapeHTML(user.quota) + '" selected="selected">' + escapeHTML(user.quota) + '</option>'); + // append before "Other" entry + $options.last().before('<option value="' + escapeHTML(user.quota) + '" selected="selected">' + escapeHTML(user.quota) + '</option>'); } } @@ -576,6 +579,15 @@ var UserList = { var $select = $(ev.target); var uid = UserList.getUID($select); var quota = $select.val(); + if (quota === 'other') { + return; + } + if (isNaN(parseInt(quota, 10)) || parseInt(quota, 10) < 0) { + // the select component has added the bogus value, delete it again + $select.find('option[selected]').remove(); + OC.Notification.showTemporary(t('core', 'Invalid quota value "{val}"', {val: quota})); + return; + } UserList._updateQuota(uid, quota, function(returnedQuota){ if (quota !== returnedQuota) { $select.find(':selected').text(returnedQuota); |