Skip to content

Commit 83cee4f

Browse files
committed
updated the condition to check the existance of the field
1 parent 88fd742 commit 83cee4f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/services/GroupService.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ async function updateGroup(currentUser, groupId, data) {
277277

278278
// update the cache only if the group has the `oldId`
279279
const cache = await helper.getCacheInstance()
280-
if (updateGroup.oldId.length > 0) cache.set(group.id, updatedGroup)
280+
if (updateGroup.oldId && updateGroup.oldId.length > 0) cache.set(group.id, updatedGroup)
281281

282282
return updatedGroup
283283
} catch (error) {
@@ -461,7 +461,7 @@ async function getGroup(currentUser, groupId, criteria) {
461461
groupToReturn = await helper.ensureExists(getSession(), 'Group', groupId, isAdmin)
462462

463463
// set the group in cache only if it is having the `oldId`
464-
if (groupToReturn.oldId.length > 0) cache.set(groupId, groupToReturn)
464+
if (groupToReturn.oldId && groupToReturn.oldId.length > 0) cache.set(groupId, groupToReturn)
465465

466466
if (!isAdmin) delete groupToReturn.status
467467

@@ -508,7 +508,7 @@ async function getGroup(currentUser, groupId, criteria) {
508508
groupToReturn.flattenGroupIdTree = flattenGroupIdTree
509509

510510
// set the group in cache only if it is having the `oldId`
511-
if (groupToReturn.oldId.length > 0) cache.set(groupId, groupToReturn)
511+
if (groupToReturn.oldId && groupToReturn.oldId.length > 0) cache.set(groupId, groupToReturn)
512512
}
513513
} else if (criteria.includeParentGroup && !groupToReturn.parentGroups) {
514514
// find parent groups

0 commit comments

Comments
 (0)