fix: org invite (#11356)
Co-authored-by: Leo Giovanetti <[email protected]>
This commit is contained in:
1 parent
45cded6b48
commit
50970dc249
8 files changed
+122
-46
No files matched your search
@@ -42,6 +42,7 @@ type MemberInvitationModalProps = {
|
||||
token?: string;
|
||||
isLoading?: boolean;
|
||||
disableCopyLink?: boolean;
|
||||
isOrg?: boolean;
|
||||
};
|
||||
|
||||
type MembershipRoleOption = {
|
||||
@@ -68,7 +69,7 @@ function toggleElementInArray(value: string[] | string | undefined, element: str
|
||||
|
||||
export default function MemberInvitationModal(props: MemberInvitationModalProps) {
|
||||
const { t } = useLocale();
|
||||
const { disableCopyLink = false } = props;
|
||||
const { disableCopyLink = false, isOrg = false } = props;
|
||||
const trpcContext = trpc.useContext();
|
||||
|
||||
const [modalImportMode, setModalInputMode] = useState<ModalMode>(
|
||||
@@ -87,7 +88,12 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
|
||||
});
|
||||
|
||||
const copyInviteLinkToClipboard = async (token: string) => {
|
||||
const inviteLink = `${WEBAPP_URL}/teams?token=${token}`;
|
||||
const isOrgInvite = isOrg;
|
||||
const teamInviteLink = `${WEBAPP_URL}/teams?token=${token}`;
|
||||
const orgInviteLink = `${WEBAPP_URL}/signup?token=${token}&callbackUrl=/getting-started`;
|
||||
|
||||
const inviteLink =
|
||||
isOrgInvite || (props?.orgMembers && props.orgMembers?.length > 0) ? orgInviteLink : teamInviteLink;
|
||||
await navigator.clipboard.writeText(inviteLink);
|
||||
showToast(t("invite_link_copied"), "success");
|
||||
};
|
||||
|
||||
@@ -90,13 +90,14 @@ const MembersView = () => {
|
||||
distinctUser: true,
|
||||
},
|
||||
{
|
||||
enabled: searchParams !== null,
|
||||
enabled: searchParams !== null && !!teamId,
|
||||
}
|
||||
);
|
||||
|
||||
const { data: team, isLoading: isTeamsLoading } = trpc.viewer.teams.get.useQuery(
|
||||
{ teamId },
|
||||
{
|
||||
enabled: !!teamId,
|
||||
onError: () => {
|
||||
router.push("/settings");
|
||||
},
|
||||
|
||||
@@ -60,6 +60,7 @@ export function InviteMemberModal(props: Props) {
|
||||
});
|
||||
}}
|
||||
teamId={orgId}
|
||||
isOrg={true}
|
||||
justEmailInvites={!!orgId}
|
||||
isLoading={inviteMemberMutation.isLoading}
|
||||
onSubmit={(values) => {
|
||||
|
||||
Reference in new issue
Block a user