diff --git a/libs/api/community/data-access/src/lib/api-community-data.service.ts b/libs/api/community/data-access/src/lib/api-community-data.service.ts index 38f6f4ba..7d193888 100644 --- a/libs/api/community/data-access/src/lib/api-community-data.service.ts +++ b/libs/api/community/data-access/src/lib/api-community-data.service.ts @@ -40,10 +40,6 @@ export class ApiCommunityDataService { async getCommunities(username: string) { return this.core.data.community.findMany({ - where: { - // Ensure that the role has at least one condition - roles: { some: { conditions: { some: {} } } }, - }, include: { roles: { // Ensure that the role has at least one condition diff --git a/libs/web/community/ui/src/lib/community-ui-list-item.tsx b/libs/web/community/ui/src/lib/community-ui-list-item.tsx index eba68e9e..c90bc4c7 100644 --- a/libs/web/community/ui/src/lib/community-ui-list-item.tsx +++ b/libs/web/community/ui/src/lib/community-ui-list-item.tsx @@ -18,6 +18,7 @@ export function CommunityUiListItem({ to?: string username: string }) { + const hasRoles = item.roles?.length const rolesAssigned = item.roles?.filter((role) => role.member) const rolesAvailable = item.roles?.filter((role) => !role.member) return ( @@ -31,36 +32,40 @@ export function CommunityUiListItem({ - }> - - - Roles assigned to {isAuthUser ? 'you' : username} - - {rolesAssigned?.length ? ( - - ) : ( - - )} - - - - Available roles - - {rolesAvailable?.length ? ( - - ) : ( - - )} - - + {hasRoles ? ( + }> + + + Roles assigned to {isAuthUser ? 'you' : username} + + {rolesAssigned?.length ? ( + + ) : ( + + )} + + + + Available roles + + {rolesAvailable?.length ? ( + + ) : ( + + )} + + + ) : ( + + )} ) diff --git a/libs/web/community/ui/src/lib/community-ui-list.tsx b/libs/web/community/ui/src/lib/community-ui-list.tsx index cdc20d86..f3ff92af 100644 --- a/libs/web/community/ui/src/lib/community-ui-list.tsx +++ b/libs/web/community/ui/src/lib/community-ui-list.tsx @@ -16,17 +16,15 @@ export function CommunityUiList({ } return ( - {communities - .filter((item) => item.roles?.length) - .map((item) => ( - - ))} + {communities.map((item) => ( + + ))} ) }