diff --git a/src/community/services/community.service.ts b/src/community/services/community.service.ts index f1b7274..54516fb 100644 --- a/src/community/services/community.service.ts +++ b/src/community/services/community.service.ts @@ -187,12 +187,14 @@ export class CommunityService { const matchingCommunityIdsQb = this.communityRepository .createQueryBuilder('c') .select('c.uuid') - .leftJoin('c.spaces', 'space') .where('c.project = :projectUuid', { projectUuid }) .andWhere('c.name != :orphanCommunityName', { orphanCommunityName: `${ORPHAN_COMMUNITY_NAME}-${project.name}`, }) .distinct(true); + if (includeSpaces) { + matchingCommunityIdsQb.leftJoin('c.spaces', 'space'); + } if (search) { matchingCommunityIdsQb