fix: Unable to invite a user to a team via username (#15868)
* fix: Fix invalid existing username DB query Signed-off-by: Souptik Datta <souptikdatta2001@gmail.com> * fix: Support adding org team member using username Signed-off-by: Souptik Datta <souptikdatta2001@gmail.com> * fix: Remove invite by username logic and fix labe to display only email Signed-off-by: Souptik Datta <souptikdatta2001@gmail.com> * refactor: Remove username support completely from invitation-modal component Signed-off-by: Souptik Datta <souptikdatta2001@gmail.com> --------- Signed-off-by: Souptik Datta <souptikdatta2001@gmail.com>
This commit is contained in:
1 parent
33e1abf4a7
commit
3b559525a8
2 files changed
+3
-5
No files matched your search
@@ -32,7 +32,6 @@ import { GoogleWorkspaceInviteButton } from "./GoogleWorkspaceInviteButton";
|
||||
|
||||
type MemberInvitationModalProps = {
|
||||
isOpen: boolean;
|
||||
justEmailInvites?: boolean;
|
||||
onExit: () => void;
|
||||
orgMembers?: RouterOutputs["viewer"]["organizations"]["getMembers"];
|
||||
onSubmit: (values: NewMemberForm, resetFields: () => void) => void;
|
||||
@@ -231,10 +230,10 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
|
||||
name="emailOrUsername"
|
||||
control={newMemberFormMethods.control}
|
||||
rules={{
|
||||
required: isOrg ? t("enter_email") : t("enter_email_or_username"),
|
||||
required: t("enter_email"),
|
||||
validate: (value) => {
|
||||
// orgs can only invite members by email
|
||||
if (typeof value === "string" && isOrg && !isEmail(value)) return t("enter_email");
|
||||
if (typeof value === "string" && !isEmail(value)) return t("enter_email");
|
||||
if (typeof value === "string")
|
||||
return validateUniqueInvite(value) || t("member_already_invited");
|
||||
},
|
||||
@@ -242,7 +241,7 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
|
||||
render={({ field: { onChange }, fieldState: { error } }) => (
|
||||
<>
|
||||
<TextField
|
||||
label={props.justEmailInvites ? t("email") : t("email_or_username")}
|
||||
label={t("email")}
|
||||
id="inviteUser"
|
||||
name="inviteUser"
|
||||
placeholder="email@example.com"
|
||||
|
||||
@@ -60,7 +60,6 @@ export function InviteMemberModal(props: Props) {
|
||||
}}
|
||||
teamId={orgId}
|
||||
isOrg={true}
|
||||
justEmailInvites={!!orgId}
|
||||
isPending={inviteMemberMutation.isPending}
|
||||
onSubmit={(values) => {
|
||||
inviteMemberMutation.mutate({
|
||||
|
||||
Reference in new issue
Block a user