feat: make org members list private (#13373)
* feat: make org members list private * fix: add isOrg to MakeTeamPrivateSwitch in other-team-members-view --------- Co-authored-by: supalarry <lauris.skraucis@gmail.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
co-authored by
supalarry
Peer Richelsen
parent
0a2e275908
commit
a6eab74fd1
@@ -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.",
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 = ({
|
||||
<>
|
||||
<SettingsToggle
|
||||
toggleSwitchAtTheEnd={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);
|
||||
|
||||
@@ -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 && (
|
||||
|
||||
Reference in New Issue
Block a user