Merge pull request #15425 from nextcloud/backport/stable15/15359

[stable15] Handle 0 B default quota properly in the web UI
This commit is contained in:
Morris Jobke 2019-05-08 10:05:56 +02:00 committed by GitHub
commit 585c0902a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -168,16 +168,16 @@ export default {
/**
* Validate quota string to make sure it's a valid human file size
*
*
* @param {string} quota Quota in readable format '5 GB'
* @returns {Promise|boolean}
*/
validateQuota(quota) {
// only used for new presets sent through @Tag
let validQuota = OC.Util.computerFileSize(quota);
if (validQuota === 0) {
if (validQuota === null) {
return this.setDefaultQuota('none');
} else if (validQuota !== null) {
} else {
// unify format output
return this.setDefaultQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(quota)));
}
@ -280,7 +280,7 @@ export default {
if (this.selectedQuota !== false) {
return this.selectedQuota;
}
if (OC.Util.computerFileSize(this.settings.defaultQuota) > 0) {
if (this.settings.defaultQuota !== this.unlimitedQuota.id && OC.Util.computerFileSize(this.settings.defaultQuota) >= 0) {
// if value is valid, let's map the quotaOptions or return custom quota
return {id:this.settings.defaultQuota, label:this.settings.defaultQuota};
}