diff --git a/apps/sim/app/api/organizations/[id]/invitations/route.ts b/apps/sim/app/api/organizations/[id]/invitations/route.ts index 85fa235c57..1506a89164 100644 --- a/apps/sim/app/api/organizations/[id]/invitations/route.ts +++ b/apps/sim/app/api/organizations/[id]/invitations/route.ts @@ -244,16 +244,40 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{ const emailsToInvite = newEmails.filter((email: string) => !pendingEmails.includes(email)) if (emailsToInvite.length === 0) { + const isSingleEmail = processedEmails.length === 1 + const existingMembersEmails = processedEmails.filter((email: string) => + existingEmails.includes(email) + ) + const pendingInvitationEmails = processedEmails.filter((email: string) => + pendingEmails.includes(email) + ) + + if (isSingleEmail) { + if (existingMembersEmails.length > 0) { + return NextResponse.json( + { + error: 'Failed to send invitation. User is already a part of the organization.', + }, + { status: 400 } + ) + } + if (pendingInvitationEmails.length > 0) { + return NextResponse.json( + { + error: + 'Failed to send invitation. A pending invitation already exists for this email.', + }, + { status: 400 } + ) + } + } + return NextResponse.json( { - error: 'All emails are already members or have pending invitations', + error: 'All emails are already members or have pending invitations.', details: { - existingMembers: processedEmails.filter((email: string) => - existingEmails.includes(email) - ), - pendingInvitations: processedEmails.filter((email: string) => - pendingEmails.includes(email) - ), + existingMembers: existingMembersEmails, + pendingInvitations: pendingInvitationEmails, }, }, { status: 400 } diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/account/account.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/account/account.tsx index 40ca2e22d2..d2747bb063 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/account/account.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/account/account.tsx @@ -232,7 +232,11 @@ export function Account(_props: AccountProps) {
{profile?.email || ''}
- {uploadError &&{uploadError}
} + {uploadError && ( ++ {uploadError} +
+ )}{createError} -
{uploadError}
} + {uploadError && ( ++ {uploadError} +
+ )}PNG or JPEG (max 5MB)
{saveError} -
+ {error instanceof Error ? error.message : 'Failed to load tools'} +
+{uploadError} -
{testResult.error || testResult.message} -
+ {toolsError instanceof Error + ? toolsError.message + : serversError instanceof Error + ? serversError.message + : 'Failed to load MCP servers'} +
+{errors.providerId.join(' ')}
-+ {errors.providerId.join(' ')} +
)}Select a pre-configured provider ID from the trusted providers list @@ -662,9 +648,9 @@ export function SSO() { )} /> {showErrors && errors.issuerUrl.length > 0 && ( -
{errors.issuerUrl.join(' ')}
-+ {errors.issuerUrl.join(' ')} +
)}{errors.domain.join(' ')}
-+ {errors.domain.join(' ')} +
)}{errors.clientId.join(' ')}
-+ {errors.clientId.join(' ')} +
)}{errors.clientSecret.join(' ')}
-+ {errors.clientSecret.join(' ')} +
)}{errors.scopes.join(' ')}
-+ {errors.scopes.join(' ')} +
)}Comma-separated list of OIDC scopes to request @@ -830,9 +816,9 @@ export function SSO() { )} /> {showErrors && errors.entryPoint.length > 0 && ( -
{errors.entryPoint.join(' ')}
-+ {errors.entryPoint.join(' ')} +
)}{errors.cert.join(' ')}
-+ {errors.cert.join(' ')} +
)}+ {error} +
+ )} +Loading...
+No workspaces available
+No workspaces available
-+ {invitationError instanceof Error && invitationError.message + ? invitationError.message + : String(invitationError)} +
)} {/* Success message */} diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/team-management/components/no-organization-view/no-organization-view.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/team-management/components/no-organization-view/no-organization-view.tsx index 0ce2c18f7f..cc8333a47e 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/team-management/components/no-organization-view/no-organization-view.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/team-management/components/no-organization-view/no-organization-view.tsx @@ -8,7 +8,6 @@ import { ModalHeader, ModalTitle, } from '@/components/emcn' -import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' @@ -87,22 +86,22 @@ export function NoOrganizationView({ - {error && ( -+ {error} +
+ )} ++ {error} +
+ )} ++ {error instanceof Error && error.message ? error.message : String(error)} +
++ {error instanceof Error && error.message ? error.message : String(error)} +
+ )}{error instanceof Error ? error.message : 'Failed to load billing data'} - - +
+