Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/provisioning_api/lib/Controller/AUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ protected function getUserSubAdminGroupsData(string $userId): array {
*/
protected function fillStorageInfo(string $userId): array {
try {
$quotaConfig = \OC::$server->getConfig()->getUserValue($userId, 'files', 'quota', 'default');
$isQuotaDefault = $quotaConfig === 'default';
\OC_Util::tearDownFS();
\OC_Util::setupFS($userId);
$storage = OC_Helper::getStorageInfo('/');
Expand All @@ -168,6 +170,7 @@ protected function fillStorageInfo(string $userId): array {
'total' => $storage['total'],
'relative' => $storage['relative'],
'quota' => $storage['quota'],
'isQuotaDefault' => $isQuotaDefault,
];
} catch (NotFoundException $ex) {
// User fs is not setup yet
Expand All @@ -181,7 +184,8 @@ protected function fillStorageInfo(string $userId): array {
}
$data = [
'quota' => $quota !== false ? $quota : 'none',
'used' => 0
'used' => 0,
'isQuotaDefault' => $isQuotaDefault,
];
}
return $data;
Expand Down
12 changes: 8 additions & 4 deletions settings/src/components/userList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,9 @@ export default {
InfiniteLoading
},
data() {
let unlimitedQuota = {id:'none', label:t('settings', 'Unlimited')},
defaultQuota = {id:'default', label:t('settings', 'Default quota')};
let unlimitedQuota = {id:'none', label:t('settings', 'Unlimited')};
return {
unlimitedQuota: unlimitedQuota,
defaultQuota: defaultQuota,
loading: {
all: false,
groups: false
Expand All @@ -168,7 +166,7 @@ export default {
mailAddress:'',
groups: [],
subAdminsGroups: [],
quota: defaultQuota,
quota: this.defaultQuota,
language: {code: 'en', name: t('settings', 'Default language')}
}
};
Expand Down Expand Up @@ -197,6 +195,12 @@ export default {
this.userSearch = new OCA.Search(this.search, this.resetSearch);
},
computed: {
defaultQuota() {
return {
id: 'default',
label: `${this.settings.defaultQuota} (${t('settings', 'Default quota')})`
};
},
settings() {
return this.$store.getters.getServerData;
},
Expand Down
4 changes: 2 additions & 2 deletions settings/src/components/userList/userRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ export default {
},
// Mapping saved values to objects
userQuota() {
if (this.user.quota.quota >= 0) {
if (this.user.quota.quota >= 0 && !this.user.quota.isQuotaDefault) {
// if value is valid, let's map the quotaOptions or return custom quota
let humanQuota = OC.Util.humanFileSize(this.user.quota.quota);
let userQuota = this.quotaOptions.find(quota => quota.id === humanQuota);
return userQuota ? userQuota : {id:humanQuota, label:humanQuota};
} else if (this.user.quota.quota === 'default') {
} else if (this.user.quota.quota === 'default' || this.user.quota.isQuotaDefault) {
// default quota is replaced by the proper value on load
return this.quotaOptions[0];
}
Expand Down