Files
Monica Khoury 97bd456842 fix: consolidate SMTP minimum interval into Rate Limits page (#51784)
## What
Moves the "Minimum interval per user" (SMTP_MAX_FREQUENCY) setting from
the Custom SMTP page to the Rate Limits page. The field is always
visible there now, disabled with a tooltip when Custom SMTP isn't
configured, linking to the SMTP settings page.

## Why
This setting can cause `over_email_send_rate_limit` errors even when all
settings on the Rate Limits page allow more traffic, because it lived
only on the SMTP page. Consolidating it onto Rate Limits makes the
actual rate-limiting behavior visible in one place.

Fixes FE-4627

## Testing
- Verified field is disabled with explanatory tooltip when Custom SMTP
is off
- Verified field becomes editable and saves correctly once Custom SMTP
is configured
- Confirmed field no longer appears on the SMTP settings page
- Ran typecheck, lint, and SmtpForm unit tests locally
2026-10-15 17:03:10 +03:00

32 lines
886 B
TypeScript

import type { components } from '@/data/api'
type AuthConfig = components['schemas']['GoTrueConfigResponse']
interface AuthConfigForm extends AuthConfig {
ENABLE_SMTP: boolean
}
export const isSmtpEnabled = (config?: Partial<AuthConfig>): boolean => {
return !!(
config?.SMTP_ADMIN_EMAIL &&
config?.SMTP_SENDER_NAME &&
config?.SMTP_USER &&
config?.SMTP_HOST &&
config?.SMTP_PASS &&
config?.SMTP_PORT &&
(config?.SMTP_MAX_FREQUENCY ?? 0) >= 0
)
}
export const generateFormValues = (config?: Partial<AuthConfig>): Partial<AuthConfigForm> => {
return {
ENABLE_SMTP: isSmtpEnabled(config),
SMTP_ADMIN_EMAIL: config?.SMTP_ADMIN_EMAIL ?? '',
SMTP_SENDER_NAME: config?.SMTP_SENDER_NAME ?? '',
SMTP_USER: config?.SMTP_USER ?? '',
SMTP_HOST: config?.SMTP_HOST ?? '',
SMTP_PASS: '',
SMTP_PORT: config?.SMTP_PORT ?? '465',
}
}