@@ -307,6 +307,7 @@ import UserRowActions from './UserRowActions.vue'
307307
308308import UserRowMixin from ' ../../mixins/UserRowMixin.js'
309309import { isObfuscated , unlimitedQuota } from ' ../../utils/userUtils.ts'
310+ import {formatFileSize , parseFileSize } from " @nextcloud/files" ;
310311
311312export default {
312313 name: ' UserRow' ,
@@ -435,9 +436,9 @@ export default {
435436
436437 usedSpace () {
437438 if (this .user .quota ? .used ) {
438- return t (' settings' , ' {size} used' , { size: OC . Util . humanFileSize (this .user .quota ? .used ) })
439+ return t (' settings' , ' {size} used' , { size: formatFileSize (this .user .quota ? .used ) })
439440 }
440- return t (' settings' , ' {size} used' , { size: OC . Util . humanFileSize (0 ) })
441+ return t (' settings' , ' {size} used' , { size: formatFileSize (0 ) })
441442 },
442443
443444 canEdit () {
@@ -451,17 +452,17 @@ export default {
451452 quota = this .settings .defaultQuota
452453 if (quota !== ' none' ) {
453454 // convert to numeric value to match what the server would usually return
454- quota = OC . Util . computerFileSize (quota)
455+ quota = parseFileSize (quota, true )
455456 }
456457 }
457458
458459 // when the default quota is unlimited, the server returns -3 here, map it to "none"
459460 if (quota === ' none' || quota === - 3 ) {
460461 return t (' settings' , ' Unlimited' )
461462 } else if (quota >= 0 ) {
462- return OC . Util . humanFileSize (quota)
463+ return formatFileSize (quota)
463464 }
464- return OC . Util . humanFileSize (0 )
465+ return formatFileSize (0 )
465466 },
466467
467468 userActions () {
@@ -498,7 +499,7 @@ export default {
498499 if (this .selectedQuota !== false ) {
499500 return this .selectedQuota
500501 }
501- if (this .settings .defaultQuota !== unlimitedQuota .id && OC . Util . computerFileSize (this .settings .defaultQuota ) >= 0 ) {
502+ if (this .settings .defaultQuota !== unlimitedQuota .id && parseFileSize (this .settings .defaultQuota , true ) >= 0 ) {
502503 // if value is valid, let's map the quotaOptions or return custom quota
503504 return { id: this .settings .defaultQuota , label: this .settings .defaultQuota }
504505 }
@@ -834,7 +835,8 @@ export default {
834835 await this .$store .dispatch (' setUserData' , {
835836 userid: this .user .id ,
836837 key: ' quota' ,
837- value: quota,
838+ // translate from locale string format to raw float format so backend can read it
839+ value: ' ' + parseFileSize (quota, true )
838840 })
839841 } catch (error) {
840842 console .error (error)
@@ -855,12 +857,12 @@ export default {
855857 quota = quota? .id || quota .label
856858 }
857859 // only used for new presets sent through @Tag
858- const validQuota = OC . Util . computerFileSize (quota)
860+ const validQuota = parseFileSize (quota, true )
859861 if (validQuota === null ) {
860862 return unlimitedQuota
861863 } else {
862864 // unify format output
863- quota = OC . Util . humanFileSize ( OC . Util . computerFileSize (quota))
865+ quota = formatFileSize ( parseFileSize (quota, true ))
864866 return { id: quota, label: quota }
865867 }
866868 },
0 commit comments