Skip to content

Commit

Permalink
feat: hack to mock a default quota for multi-personal accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
JuancaG05 committed Nov 26, 2024
1 parent b646643 commit 639484f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ class OCSpacesRepository(
remoteSpacesDataSource.refreshSpacesForAccount(accountName).also { listOfSpaces ->
localSpacesDataSource.saveSpacesForAccount(listOfSpaces)
val personalSpace = listOfSpaces.find { it.isPersonal }
val isMultiPersonal = listOfSpaces.count { it.isPersonal } > 1
personalSpace?.let {
val userQuota = if (it.quota?.total!!.toInt() == 0) {
val userQuota = if (isMultiPersonal) {
UserQuota(accountName, 0, 0, 0, UserQuotaState.NORMAL)
} else if (it.quota?.total!!.toInt() == 0) {
UserQuota(accountName, -3, it.quota?.used!!, it.quota?.total!!, UserQuotaState.fromValue(it.quota?.state!!))
} else {
UserQuota(accountName, it.quota?.remaining!!, it.quota?.used!!, it.quota?.total!!, UserQuotaState.fromValue(it.quota?.state!!))
Expand Down

0 comments on commit 639484f

Please sign in to comment.