Fix invite user dialog create people + connection prepend edge
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<6067ce11fa959cba895d2b10862592de>>
|
||||
* @generated SignedSource<<37b59716fa1aba5ed805ce03278ce01d>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -111,13 +111,7 @@ return {
|
||||
"kind": "RequiredField",
|
||||
"field": {
|
||||
"alias": "invitations",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "orderBy",
|
||||
"variableName": "order"
|
||||
}
|
||||
],
|
||||
"args": null,
|
||||
"concreteType": "InvitationConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "__InvitationListFragment_invitations_connection",
|
||||
@@ -239,6 +233,6 @@ return {
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "837e567be489574a7f0350e26a8e5454";
|
||||
(node as any).hash = "6a1b77bc8b0e5f345de9865ec78ef7e9";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<6d84f6b0d10bbae09a14ecc5d84c2814>>
|
||||
* @generated SignedSource<<26a05edf635e281469d5498e24879e00>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -355,9 +355,7 @@ return {
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v13/*: any*/),
|
||||
"filters": [
|
||||
"orderBy"
|
||||
],
|
||||
"filters": [],
|
||||
"handle": "connection",
|
||||
"key": "InvitationListFragment_invitations",
|
||||
"kind": "LinkedHandle",
|
||||
@@ -383,6 +381,6 @@ return {
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "837e567be489574a7f0350e26a8e5454";
|
||||
(node as any).hash = "6a1b77bc8b0e5f345de9865ec78ef7e9";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<438f2d019c7a08242f35c048016a97e1>>
|
||||
* @generated SignedSource<<14b3e1990be5f8333046dffcada56516>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -11,7 +11,6 @@
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type MembershipRole = "ADMIN" | "AUDITOR" | "EMPLOYEE" | "OWNER" | "VIEWER";
|
||||
export type InviteMemberInput = {
|
||||
createPeople: boolean;
|
||||
email: string;
|
||||
fullName: string;
|
||||
organizationId: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<5854e660d90c68e5ec01199e55c42a41>>
|
||||
* @generated SignedSource<<70828342a675d5b198c87a4a00455155>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -197,10 +197,7 @@ v17 = {
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
v18 = [
|
||||
"orderBy"
|
||||
];
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
@@ -407,7 +404,9 @@ return {
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v6/*: any*/),
|
||||
"filters": (v18/*: any*/),
|
||||
"filters": [
|
||||
"orderBy"
|
||||
],
|
||||
"handle": "connection",
|
||||
"key": "MemberListFragment_members",
|
||||
"kind": "LinkedHandle",
|
||||
@@ -493,7 +492,7 @@ return {
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v6/*: any*/),
|
||||
"filters": (v18/*: any*/),
|
||||
"filters": [],
|
||||
"handle": "connection",
|
||||
"key": "InvitationListFragment_invitations",
|
||||
"kind": "LinkedHandle",
|
||||
|
||||
@@ -26,7 +26,7 @@ const fragment = graphql`
|
||||
before: $before
|
||||
orderBy: $order
|
||||
)
|
||||
@connection(key: "InvitationListFragment_invitations")
|
||||
@connection(key: "InvitationListFragment_invitations", filters: [])
|
||||
@required(action: THROW) {
|
||||
__id
|
||||
totalCount
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
Option,
|
||||
DialogFooter,
|
||||
Button,
|
||||
Checkbox,
|
||||
useDialogRef,
|
||||
} from "@probo/ui";
|
||||
import { Controller } from "react-hook-form";
|
||||
@@ -57,7 +56,6 @@ const schema = z.object({
|
||||
role: z
|
||||
.enum(["OWNER", "ADMIN", "FULL", "VIEWER", "AUDITOR", "EMPLOYEE"])
|
||||
.default("VIEWER"),
|
||||
createPeople: z.boolean().default(false),
|
||||
});
|
||||
|
||||
type InviteUserDialogProps = PropsWithChildren<{
|
||||
@@ -85,13 +83,14 @@ export function InviteUserDialog(props: InviteUserDialogProps) {
|
||||
|
||||
const { register, handleSubmit, formState, reset, control } =
|
||||
useFormWithSchema(schema, {
|
||||
defaultValues: { role: "VIEWER", createPeople: false },
|
||||
defaultValues: { role: "VIEWER" },
|
||||
});
|
||||
|
||||
const onSubmit = handleSubmit((data) => {
|
||||
const connectionId = ConnectionHandler.getConnectionID(
|
||||
organizationId,
|
||||
"InvitationListFragment_invitations",
|
||||
{},
|
||||
);
|
||||
inviteUser({
|
||||
variables: {
|
||||
@@ -100,7 +99,6 @@ export function InviteUserDialog(props: InviteUserDialogProps) {
|
||||
email: data.email,
|
||||
fullName: data.fullName,
|
||||
role: data.role,
|
||||
createPeople: data.createPeople,
|
||||
},
|
||||
connections: [connectionId],
|
||||
},
|
||||
@@ -189,33 +187,6 @@ export function InviteUserDialog(props: InviteUserDialogProps) {
|
||||
)}
|
||||
/>
|
||||
</Field>
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center space-x-3">
|
||||
<Controller
|
||||
name="createPeople"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<>
|
||||
<Checkbox
|
||||
checked={field.value ?? false}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
<label
|
||||
className="text-sm font-medium cursor-pointer"
|
||||
onClick={() => field.onChange(!field.value)}
|
||||
>
|
||||
{__("Create people record")}
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-xs text-txt-secondary ml-7">
|
||||
{__(
|
||||
"Creates a people record for this user in addition to the user account",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</DialogContent>
|
||||
<DialogFooter>
|
||||
<Button type="submit" disabled={isInviting}>
|
||||
|
||||
Reference in New Issue
Block a user