@@ -277,7 +277,7 @@ async function updateGroup(currentUser, groupId, data) {
277
277
278
278
// update the cache only if the group has the `oldId`
279
279
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 )
281
281
282
282
return updatedGroup
283
283
} catch ( error ) {
@@ -461,7 +461,7 @@ async function getGroup(currentUser, groupId, criteria) {
461
461
groupToReturn = await helper . ensureExists ( getSession ( ) , 'Group' , groupId , isAdmin )
462
462
463
463
// 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 )
465
465
466
466
if ( ! isAdmin ) delete groupToReturn . status
467
467
@@ -508,7 +508,7 @@ async function getGroup(currentUser, groupId, criteria) {
508
508
groupToReturn . flattenGroupIdTree = flattenGroupIdTree
509
509
510
510
// 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 )
512
512
}
513
513
} else if ( criteria . includeParentGroup && ! groupToReturn . parentGroups ) {
514
514
// find parent groups
0 commit comments