Scheduling infrastructure for absolutely everyone.
feat: make org members list private (#13373)
Amit Sharmaa6eab74fd1bb
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex f6e2cd88ac9..a0f864523c7 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -1066,6 +1066,8 @@"user_impersonation_description": "Allows our support team to temporarily sign in as you to help us quickly resolve any issues you report to us.","team_impersonation_description": "Allows your team Owners/Admins to temporarily sign in as you.","cal_signup_description":"Free for individuals. Team plans for collaborative features.",+ "make_org_private": "Make organization private",+ "make_org_private_description": "Your organization members won't be able to see other organization members when this is turned on.","make_team_private": "Make team private","make_team_private_description": "Your team members won't be able to see other team members when this is turned on.","you_cannot_see_team_members": "You cannot see all the team members of a private team.",diff --git a/packages/features/ee/organizations/pages/settings/members.tsx b/packages/features/ee/organizations/pages/settings/members.tsxindex 3e039f32744..e247b459cab 100644--- a/packages/features/ee/organizations/pages/settings/members.tsx+++ b/packages/features/ee/organizations/pages/settings/members.tsx@@ -1,19 +1,38 @@"use client";import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";+import MakeTeamPrivateSwitch from "@calcom/features/ee/teams/components/MakeTeamPrivateSwitch";import { getLayout } from "@calcom/features/settings/layouts/SettingsLayout";import { UserListTable } from "@calcom/features/users/components/UserTable/UserListTable";import { useLocale } from "@calcom/lib/hooks/useLocale";+import { MembershipRole } from "@calcom/prisma/enums";+import { trpc } from "@calcom/trpc/react";import { Meta } from "@calcom/ui";const MembersView = () => {const { t } = useLocale();+ const { data: currentOrg } = trpc.viewer.organizations.listCurrent.useQuery();++ const isInviteOpen = !currentOrg?.user.accepted;+ const isOrgAdminOrOwner =+ currentOrg &&+ (currentOrg.user.role === MembershipRole.OWNER || currentOrg.user.role === MembershipRole.ADMIN);return (<LicenseRequired><Meta title={t("organization_members")} description={t("organization_description")} /><div>- <UserListTable />+ {((currentOrg?.isPrivate && isOrgAdminOrOwner) || isOrgAdminOrOwner || !currentOrg?.isPrivate) && (+ <UserListTable />+ )}+ {currentOrg && isOrgAdminOrOwner && (+ <MakeTeamPrivateSwitch+ isOrg={true}+ teamId={currentOrg.id}+ isPrivate={currentOrg.isPrivate}+ disabled={isInviteOpen}+ />+ )}</div></LicenseRequired>);diff --git a/packages/features/ee/organizations/pages/settings/other-team-members-view.tsx b/packages/features/ee/organizations/pages/settings/other-team-members-view.tsxindex a40a233fe4d..a120a6a25c6 100644--- a/packages/features/ee/organizations/pages/settings/other-team-members-view.tsx+++ b/packages/features/ee/organizations/pages/settings/other-team-members-view.tsx@@ -192,7 +192,12 @@ const MembersView = () => {{team && (<><hr className="border-subtle my-8" />- <MakeTeamPrivateSwitch teamId={team.id} isPrivate={team.isPrivate} disabled={false} />+ <MakeTeamPrivateSwitch+ teamId={team.id}+ isPrivate={team.isPrivate}+ disabled={false}+ isOrg={false}+ /></>)}</div>diff --git a/packages/features/ee/teams/components/MakeTeamPrivateSwitch.tsx b/packages/features/ee/teams/components/MakeTeamPrivateSwitch.tsxindex 26450caf970..c04d0a728db 100644--- a/packages/features/ee/teams/components/MakeTeamPrivateSwitch.tsx+++ b/packages/features/ee/teams/components/MakeTeamPrivateSwitch.tsx@@ -8,10 +8,12 @@ const MakeTeamPrivateSwitch = ({teamId,isPrivate,disabled,+ isOrg,}: {teamId: number;isPrivate: boolean;disabled: boolean;+ isOrg: boolean;}) => {const { t } = useLocale();@@ -23,7 +25,7 @@ const MakeTeamPrivateSwitch = ({},async onSuccess() {await utils.viewer.teams.get.invalidate();- showToast(t("your_team_updated_successfully"), "success");+ showToast(t(isOrg ? "your_org_updated_successfully" : "your_team_updated_successfully"), "success");},});@@ -33,9 +35,9 @@ const MakeTeamPrivateSwitch = ({<><SettingsToggletoggleSwitchAtTheEnd={true}- title={t("make_team_private")}+ title={t(isOrg ? "make_org_private" : "make_team_private")}disabled={disabled || mutation?.isPending}- description={t("make_team_private_description")}+ description={t(isOrg ? "make_org_private_description" : "make_team_private_description")}checked={isTeamPrivate}onCheckedChange={(checked) => {setTeamPrivate(checked);diff --git a/packages/features/ee/teams/pages/team-members-view.tsx b/packages/features/ee/teams/pages/team-members-view.tsxindex fdc061188bc..ac19cba4758 100644--- a/packages/features/ee/teams/pages/team-members-view.tsx+++ b/packages/features/ee/teams/pages/team-members-view.tsx@@ -194,7 +194,12 @@ const MembersView = () => {)}{team && (isAdmin || isOrgAdminOrOwner) && (- <MakeTeamPrivateSwitch teamId={team.id} isPrivate={team.isPrivate} disabled={isInviteOpen} />+ <MakeTeamPrivateSwitch+ isOrg={false}+ teamId={team.id}+ isPrivate={team.isPrivate}+ disabled={isInviteOpen}+ />)}</div>{showMemberInvitationModal && team && (