From e856817d2b64431000e898baeda9f4680eee54d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Thu, 5 Mar 2026 11:19:19 +0400 Subject: [PATCH] Remove full name input from nda page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- .../PeopleGraphPaginatedFragment.graphql.ts | 4 +- .../iam/PersonFormFragment.graphql.ts | 4 +- .../iam/PersonForm_createMutation.graphql.ts | 4 +- .../iam/PersonForm_updateMutation.graphql.ts | 4 +- .../people/_components/PersonForm.tsx | 2 +- apps/trust/src/pages/NDAPage.tsx | 43 ++++--------------- ...ceptElectronicSignatureMutation.graphql.ts | 3 +- pkg/iam/auth_service.go | 32 -------------- pkg/server/api/trust/v1/schema.graphql | 1 - pkg/server/api/trust/v1/schema/schema.go | 10 +---- pkg/server/api/trust/v1/types/types.go | 1 - pkg/server/api/trust/v1/v1_resolver.go | 12 +----- 12 files changed, 20 insertions(+), 100 deletions(-) diff --git a/apps/console/src/__generated__/core/PeopleGraphPaginatedFragment.graphql.ts b/apps/console/src/__generated__/core/PeopleGraphPaginatedFragment.graphql.ts index 710c3ba4a..3d95b93f2 100644 --- a/apps/console/src/__generated__/core/PeopleGraphPaginatedFragment.graphql.ts +++ b/apps/console/src/__generated__/core/PeopleGraphPaginatedFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<426a1227dea8949a1d77d75edf05437a>> * @lightSyntaxTransform * @nogrep */ @@ -26,7 +26,7 @@ export type PeopleGraphPaginatedFragment$data = { readonly emailAddress: string; readonly fullName: string; readonly id: string; - readonly kind: ProfileKind; + readonly kind: ProfileKind | null | undefined; readonly position: string | null | undefined; }; }>; diff --git a/apps/console/src/__generated__/iam/PersonFormFragment.graphql.ts b/apps/console/src/__generated__/iam/PersonFormFragment.graphql.ts index d74dd66b0..c2a2ee674 100644 --- a/apps/console/src/__generated__/iam/PersonFormFragment.graphql.ts +++ b/apps/console/src/__generated__/iam/PersonFormFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<1eea90ca68f7381b881c68f0489837cb>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -20,7 +20,7 @@ export type PersonFormFragment$data = { readonly emailAddress: string; readonly fullName: string; readonly id: string; - readonly kind: ProfileKind; + readonly kind: ProfileKind | null | undefined; readonly membership: { readonly role: MembershipRole; }; diff --git a/apps/console/src/__generated__/iam/PersonForm_createMutation.graphql.ts b/apps/console/src/__generated__/iam/PersonForm_createMutation.graphql.ts index 02b9f45c3..310190464 100644 --- a/apps/console/src/__generated__/iam/PersonForm_createMutation.graphql.ts +++ b/apps/console/src/__generated__/iam/PersonForm_createMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<7889e38e185230a2c5b41c3b0fb73cca>> + * @generated SignedSource<<8ef1dc9de9a669636884e4f60f7f39fc>> * @lightSyntaxTransform * @nogrep */ @@ -18,7 +18,7 @@ export type CreateUserInput = { contractStartDate?: string | null | undefined; emailAddress: string; fullName: string; - kind: ProfileKind; + kind?: ProfileKind | null | undefined; organizationId: string; position?: string | null | undefined; role: MembershipRole; diff --git a/apps/console/src/__generated__/iam/PersonForm_updateMutation.graphql.ts b/apps/console/src/__generated__/iam/PersonForm_updateMutation.graphql.ts index 04af2a391..6efc61142 100644 --- a/apps/console/src/__generated__/iam/PersonForm_updateMutation.graphql.ts +++ b/apps/console/src/__generated__/iam/PersonForm_updateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<8563f3b122bb8d5b6c2e5e7354a0a0c8>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -16,7 +16,7 @@ export type UpdateUserInput = { contractStartDate?: string | null | undefined; fullName: string; id: string; - kind: ProfileKind; + kind?: ProfileKind | null | undefined; position?: string | null | undefined; }; export type PersonForm_updateMutation$variables = { diff --git a/apps/console/src/pages/iam/organizations/people/_components/PersonForm.tsx b/apps/console/src/pages/iam/organizations/people/_components/PersonForm.tsx index f8f951d85..6c502c50a 100644 --- a/apps/console/src/pages/iam/organizations/people/_components/PersonForm.tsx +++ b/apps/console/src/pages/iam/organizations/people/_components/PersonForm.tsx @@ -68,7 +68,7 @@ const schema = z.object({ v => (v as string[]).filter(v => !!v), z.array(z.string().email()), ), - kind: z.enum(peopleRoles), + kind: z.enum(peopleRoles).optional().nullable(), contractStartDate: z.string().optional().nullable(), contractEndDate: z.string().optional().nullable(), }); diff --git a/apps/trust/src/pages/NDAPage.tsx b/apps/trust/src/pages/NDAPage.tsx index bfe60deb3..bec89107b 100644 --- a/apps/trust/src/pages/NDAPage.tsx +++ b/apps/trust/src/pages/NDAPage.tsx @@ -1,6 +1,6 @@ import { sprintf } from "@probo/helpers"; import { useTranslate } from "@probo/i18n"; -import { Button, Card, Field, IconCircleX, Logo, Spinner } from "@probo/ui"; +import { Button, Card, IconCircleX, Logo, Spinner } from "@probo/ui"; import { startTransition, useEffect, useRef } from "react"; import { type PreloadedQuery, @@ -11,10 +11,8 @@ import { import { Navigate, useSearchParams } from "react-router"; import { graphql } from "relay-runtime"; import { useWindowSize } from "usehooks-ts"; -import { z } from "zod"; import { PDFPreview } from "#/components/PDFPreview"; -import { useFormWithSchema } from "#/hooks/useFormWithSchema"; import { getPathPrefix } from "#/utils/pathPrefix"; import type { NDAPageAcceptElectronicSignatureMutation } from "./__generated__/NDAPageAcceptElectronicSignatureMutation.graphql"; @@ -81,10 +79,6 @@ const recordSigningEventMutation = graphql` } `; -const schema = z.object({ - fullName: z.string().min(1), -}); - export function NDAPage(props: { queryRef: PreloadedQuery; }) { @@ -137,16 +131,6 @@ export function NDAPage(props: { const isFailed = ndaSignature?.status === "FAILED"; const isCompleted = ndaSignature?.status === "COMPLETED"; - const { - handleSubmit: handleSubmitWrapper, - register, - formState, - } = useFormWithSchema(schema, { - defaultValues: { - fullName: viewer?.fullName, - }, - }); - useEffect(() => { if (isCompleted) { window.location.href = safeContinueUrl; @@ -182,7 +166,7 @@ export function NDAPage(props: { } }, [ndaSignature, recordSigningEvent]); - const handleSubmit = handleSubmitWrapper(({ fullName }) => { + const handleAccept = () => { if (!ndaSignature) return; if (ndaSignature.status === "PENDING") { @@ -208,13 +192,12 @@ export function NDAPage(props: { variables: { input: { signatureId: ndaSignature.id, - fullName, }, }, }); }, }); - }); + }; const nda = trustCenter.nonDisclosureAgreement; if (!viewer) { @@ -260,18 +243,7 @@ export function NDAPage(props: { )} -
void handleSubmit(e)} - className="mt-8" - > - +

{consentText}

@@ -302,9 +274,10 @@ export function NDAPage(props: { ) : ( )} - +
> + * @generated SignedSource<<319d6df7ac6b5452d4a74501a35cec43>> * @lightSyntaxTransform * @nogrep */ @@ -11,7 +11,6 @@ import { ConcreteRequest } from 'relay-runtime'; export type ElectronicSignatureStatus = "ACCEPTED" | "COMPLETED" | "FAILED" | "PENDING" | "PROCESSING"; export type AcceptElectronicSignatureInput = { - fullName: string; signatureId: string; }; export type NDAPageAcceptElectronicSignatureMutation$variables = { diff --git a/pkg/iam/auth_service.go b/pkg/iam/auth_service.go index 523c54dcf..acb0f1984 100644 --- a/pkg/iam/auth_service.go +++ b/pkg/iam/auth_service.go @@ -751,38 +751,6 @@ func (s AuthService) OpenSessionWithMagicLink(ctx context.Context, tokenString s return identity, session, payload.Data.Continue, nil } -func (s *AuthService) UpdateIdentity(ctx context.Context, identityID gid.GID, fullName string) (*coredata.Identity, error) { - identity := &coredata.Identity{} - - err := s.pg.WithTx( - ctx, - func(tx pg.Conn) error { - if err := identity.LoadByID(ctx, tx, identityID); err != nil { - if errors.Is(err, coredata.ErrResourceNotFound) { - return NewIdentityNotFoundError(identityID) - } - - return fmt.Errorf("cannot load identity: %w", err) - } - - identity.FullName = fullName - identity.UpdatedAt = time.Now() - - if err := identity.Update(ctx, tx); err != nil { - if errors.Is(err, coredata.ErrResourceNotFound) { - return NewIdentityNotFoundError(identityID) - } - - return fmt.Errorf("cannot update identity: %w", err) - } - - return nil - }, - ) - - return identity, err -} - func HashToken(token string) []byte { hash := sha256.Sum256([]byte(token)) return hash[:] diff --git a/pkg/server/api/trust/v1/schema.graphql b/pkg/server/api/trust/v1/schema.graphql index 92f53df21..94ba9404c 100644 --- a/pkg/server/api/trust/v1/schema.graphql +++ b/pkg/server/api/trust/v1/schema.graphql @@ -801,7 +801,6 @@ type ElectronicSignature implements Node { input AcceptElectronicSignatureInput { signatureId: ID! - fullName: String! } type AcceptElectronicSignaturePayload { diff --git a/pkg/server/api/trust/v1/schema/schema.go b/pkg/server/api/trust/v1/schema/schema.go index 2c9ea2f5c..9cd3a351f 100644 --- a/pkg/server/api/trust/v1/schema/schema.go +++ b/pkg/server/api/trust/v1/schema/schema.go @@ -2223,7 +2223,6 @@ type ElectronicSignature implements Node { input AcceptElectronicSignatureInput { signatureId: ID! - fullName: String! } type AcceptElectronicSignaturePayload { @@ -9294,7 +9293,7 @@ func (ec *executionContext) unmarshalInputAcceptElectronicSignatureInput(ctx con asMap[k] = v } - fieldsInOrder := [...]string{"signatureId", "fullName"} + fieldsInOrder := [...]string{"signatureId"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -9308,13 +9307,6 @@ func (ec *executionContext) unmarshalInputAcceptElectronicSignatureInput(ctx con return it, err } it.SignatureID = data - case "fullName": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fullName")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.FullName = data } } return it, nil diff --git a/pkg/server/api/trust/v1/types/types.go b/pkg/server/api/trust/v1/types/types.go index 252613a23..b997a084d 100644 --- a/pkg/server/api/trust/v1/types/types.go +++ b/pkg/server/api/trust/v1/types/types.go @@ -18,7 +18,6 @@ type Node interface { type AcceptElectronicSignatureInput struct { SignatureID gid.GID `json:"signatureId"` - FullName string `json:"fullName"` } type AcceptElectronicSignaturePayload struct { diff --git a/pkg/server/api/trust/v1/v1_resolver.go b/pkg/server/api/trust/v1/v1_resolver.go index 5aa116e35..943a2d564 100644 --- a/pkg/server/api/trust/v1/v1_resolver.go +++ b/pkg/server/api/trust/v1/v1_resolver.go @@ -597,16 +597,6 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input httpReq = gqlutils.HTTPRequestFromContext(ctx) ) - if _, err := r.iam.AuthService.UpdateIdentity(ctx, identity.ID, input.FullName); err != nil { - var errNotFound *iam.ErrIdentityNotFound - if errors.As(err, &errNotFound) { - return nil, gqlutils.NotFound(ctx, err) - } - - r.logger.ErrorCtx(ctx, "cannot update identity", log.Error(err)) - return nil, gqlutils.Internal(ctx) - } - signerIP, _, _ := net.SplitHostPort(httpReq.RemoteAddr) if signerIP == "" { signerIP = httpReq.RemoteAddr @@ -616,7 +606,7 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input ctx, &esign.AcceptSignatureRequest{ SignatureID: input.SignatureID, - SignerFullName: input.FullName, + SignerFullName: identity.FullName, SignerEmail: identity.EmailAddress, SignerIPAddr: signerIP, SignerUA: httpReq.UserAgent(),