diff --git a/apps/web/pages/team/[slug].tsx b/apps/web/pages/team/[slug].tsx
index 8477bdf5bd..8d5bf7e953 100644
--- a/apps/web/pages/team/[slug].tsx
+++ b/apps/web/pages/team/[slug].tsx
@@ -129,7 +129,8 @@ function TeamPage({ team, isUnpublished, markdownStrippedBio, isValidOrgDomain }
{ch.name}
{t("number_member", {
- count: ch.members.filter((mem) => mem.user.username !== null).length,
+ count: team.members.filter((mem) => mem.subteams?.includes(ch.slug) && mem.accepted)
+ .length,
})}
@@ -138,9 +139,9 @@ function TeamPage({ team, isUnpublished, markdownStrippedBio, isValidOrgDomain }
className="mr-6"
size="sm"
truncateAfter={4}
- items={ch.members
- .filter((mem) => mem.user.username !== null)
- .map(({ user: member }) => ({
+ items={team.members
+ .filter((mem) => mem.subteams?.includes(ch.slug) && mem.accepted)
+ .map((member) => ({
alt: member.name || "",
image: `/${member.username}/avatar.png`,
title: member.name || "",
@@ -316,7 +317,9 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
name: member.name,
id: member.id,
bio: member.bio,
+ subteams: member.subteams,
username: member.username,
+ accepted: member.accepted,
safeBio: markdownToSafeHTML(member.bio || ""),
};
});
diff --git a/packages/lib/server/queries/teams/index.ts b/packages/lib/server/queries/teams/index.ts
index 2ae65dc038..61c3639564 100644
--- a/packages/lib/server/queries/teams/index.ts
+++ b/packages/lib/server/queries/teams/index.ts
@@ -28,6 +28,15 @@ export async function getTeamWithMembers(args: {
externalId: true,
},
},
+ teams: {
+ select: {
+ team: {
+ select: {
+ slug: true,
+ },
+ },
+ },
+ },
selectedCalendars: true,
credentials: {
select: {
@@ -68,16 +77,6 @@ export async function getTeamWithMembers(args: {
name: true,
logo: true,
slug: true,
- members: {
- select: {
- user: {
- select: {
- name: true,
- username: true,
- },
- },
- },
- },
},
},
members: {
@@ -142,6 +141,9 @@ export async function getTeamWithMembers(args: {
role: obj.role,
accepted: obj.accepted,
disableImpersonation: obj.disableImpersonation,
+ subteams: orgSlug
+ ? obj.user.teams.filter((obj) => obj.team.slug !== orgSlug).map((obj) => obj.team.slug)
+ : null,
avatar: `${WEBAPP_URL}/${obj.user.username}/avatar.png`,
connectedApps: obj?.user?.credentials?.map((cred) => {
const appSlug = cred.app?.slug;