mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
fix(settings): Fix incorrect user quota on page reload in non-English locales
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
9b164540d5
commit
c020561a72
5 changed files with 12 additions and 11 deletions
|
|
@ -262,7 +262,6 @@ import Vue from 'vue'
|
|||
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
|
||||
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
|
||||
import NcMultiselect from '@nextcloud/vue/dist/Components/NcMultiselect.js'
|
||||
import { formatFileSize, parseFileSize } from '@nextcloud/files'
|
||||
|
||||
import userRow from './UserList/UserRow.vue'
|
||||
|
||||
|
|
@ -487,10 +486,10 @@ export default {
|
|||
*/
|
||||
validateQuota(quota) {
|
||||
// only used for new presets sent through @Tag
|
||||
const validQuota = parseFileSize(quota, true)
|
||||
const validQuota = OC.Util.computerFileSize(quota)
|
||||
if (validQuota !== null && validQuota >= 0) {
|
||||
// unify format output
|
||||
quota = formatFileSize(parseFileSize(quota, true))
|
||||
quota = OC.Util.humanFileSize(OC.Util.computerFileSize(quota))
|
||||
this.newUser.quota = { id: quota, label: quota }
|
||||
return this.newUser.quota
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,7 +268,6 @@
|
|||
|
||||
<script>
|
||||
import ClickOutside from 'vue-click-outside'
|
||||
import { formatFileSize, parseFileSize } from '@nextcloud/files'
|
||||
|
||||
import {
|
||||
NcPopoverMenu,
|
||||
|
|
@ -689,7 +688,7 @@ export default {
|
|||
await this.$store.dispatch('setUserData', {
|
||||
userid: this.user.id,
|
||||
key: 'quota',
|
||||
value: '' + parseFileSize(quota, true),
|
||||
value: String(OC.Util.computerFileSize(quota)),
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
|
@ -707,10 +706,10 @@ export default {
|
|||
*/
|
||||
validateQuota(quota) {
|
||||
// only used for new presets sent through @Tag
|
||||
const validQuota = parseFileSize(quota, true)
|
||||
const validQuota = OC.Util.computerFileSize(quota)
|
||||
if (validQuota !== null && validQuota >= 0) {
|
||||
// unify format output
|
||||
return this.setUserQuota(formatFileSize(parseFileSize(quota, true)))
|
||||
return this.setUserQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(quota)))
|
||||
}
|
||||
// if no valid do not change
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import api from './api.js'
|
|||
import axios from '@nextcloud/axios'
|
||||
import { generateOcsUrl } from '@nextcloud/router'
|
||||
import logger from '../logger.js'
|
||||
import { parseFileSize } from '@nextcloud/files'
|
||||
|
||||
const orderGroups = function(groups, orderBy) {
|
||||
/* const SORT_USERCOUNT = 1;
|
||||
|
|
@ -212,7 +211,7 @@ const mutations = {
|
|||
},
|
||||
setUserData(state, { userid, key, value }) {
|
||||
if (key === 'quota') {
|
||||
const humanValue = parseFileSize(value, true)
|
||||
const humanValue = OC.Util.computerFileSize(value)
|
||||
state.users.find(user => user.id === userid)[key][key] = humanValue !== null ? humanValue : value
|
||||
} else {
|
||||
state.users.find(user => user.id === userid)[key] = value
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ describe('Core base tests', function() {
|
|||
['-1234 B', null],
|
||||
['B', null],
|
||||
['40/0', null],
|
||||
['40,30 kb', null],
|
||||
['40,30 kb', 41267],
|
||||
[' 122.1 MB ', 128031130],
|
||||
['122.1 MB ', 128031130],
|
||||
[' 122.1 MB ', 128031130],
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import moment from 'moment'
|
|||
import History from './util-history.js'
|
||||
import OC from './index.js'
|
||||
import { formatFileSize as humanFileSize } from '@nextcloud/files'
|
||||
import { getCanonicalLocale } from '@nextcloud/l10n'
|
||||
|
||||
/**
|
||||
* @param {any} t -
|
||||
|
|
@ -85,7 +86,10 @@ export default {
|
|||
return null
|
||||
}
|
||||
|
||||
const s = string.toLowerCase().trim()
|
||||
const s = string
|
||||
.toLocaleLowerCase(getCanonicalLocale())
|
||||
.replaceAll(',', '.')
|
||||
.trim()
|
||||
let bytes = null
|
||||
|
||||
const bytesArray = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue