Skip to content

Commit 2cbb4cf

Browse files
committed
Fix processing and checking of id_quota
1 parent 677905a commit 2cbb4cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/repositories/baseOrgRepository.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class BaseOrgRepository extends BaseRepository {
211211
registryObject = await SecretariatObjectToSave.save(options)
212212
} else if (registryObjectRaw.authority.includes('CNA')) {
213213
// A special case, we should make sure we have the default quota if it is not set
214-
if (registryObjectRaw.hard_quota === undefined) {
214+
if (!registryObjectRaw.hard_quota) {
215215
// set to default quota if none is specified
216216
registryObjectRaw.hard_quota = CONSTANTS.DEFAULT_ID_QUOTA
217217
}
@@ -232,16 +232,16 @@ class BaseOrgRepository extends BaseRepository {
232232

233233
//* ******* Legacy has some special cases that we have to deal with here.**************
234234
legacyObjectRaw.inUse = false
235-
if (legacyObjectRaw.policies.id_quota === undefined) {
235+
if (!legacyObjectRaw?.policies?.id_quota) {
236236
// set to default quota if none is specified
237-
legacyObjectRaw.policies.id_quota = CONSTANTS.DEFAULT_ID_QUOTA
237+
_.set(legacyObjectRaw, 'policies.id_quota', CONSTANTS.DEFAULT_ID_QUOTA)
238238
}
239239
if (
240240
legacyObjectRaw.authority.active_roles.length === 1 &&
241241
legacyObjectRaw.authority.active_roles[0] === 'ADP'
242242
) {
243243
// ADPs have quota of 0
244-
legacyObjectRaw.policies.id_quota = 0
244+
_.set(legacyObjectRaw, 'policies.id_quota', 0)
245245
}
246246

247247
// The legacy way of doing this, the way this is written under the hood there is no other way

0 commit comments

Comments
 (0)