This commit is contained in:
rustmailer
2026-05-14 22:11:10 +08:00
parent 907e59027d
commit 3fa4fe453c
24 changed files with 83 additions and 9 deletions
@@ -114,6 +114,7 @@ export type Account = {
folder_limit?: number;
download_interval_min: number;
download_batch_size: number;
auto_download_new_mailboxes: boolean;
};
const getAccountSchema = (isEdit: boolean, t: (key: string) => string) =>
@@ -138,6 +139,7 @@ const getAccountSchema = (isEdit: boolean, t: (key: string) => string) =>
.int()
.min(10, { message: t('validation.singleRequestBatchSizeTooSmall') })
.max(200, { message: t('validation.singleRequestBatchSizeTooLarge') }),
auto_download_new_mailboxes: z.boolean(),
});
type Step = {
@@ -151,7 +153,7 @@ export type Steps = [...Step[]];
const getSteps = (t: (key: string) => string): Steps => [
{ id: "step-1", name: t('accounts.steps.emailAddress'), fields: ["email", "account_name"] },
{ id: "step-2", name: t('accounts.steps.imap'), fields: ["imap", "use_dangerous", "login_name"] },
{ id: "step-3", name: t('accounts.steps.syncPreferences'), fields: ["enabled", "date_since", "date_before", "folder_limit", "download_interval_min", "download_batch_size"] },
{ id: "step-3", name: t('accounts.steps.syncPreferences'), fields: ["enabled", "date_since", "date_before", "folder_limit", "download_interval_min", "download_batch_size", "auto_download_new_mailboxes"] },
{ id: "step-4", name: t('accounts.steps.summary'), fields: [] },
];
@@ -184,6 +186,7 @@ const defaultValues: Account = {
folder_limit: undefined,
download_interval_min: 60,
download_batch_size: 30,
auto_download_new_mailboxes: true,
};
const emptyImap: ImapConfig = {
@@ -212,6 +215,7 @@ const mapCurrentRowToFormValues = (currentRow: AccountModel): Account => {
folder_limit: currentRow.folder_limit ?? undefined,
download_interval_min: currentRow.download_interval_min ?? 60,
download_batch_size: currentRow.download_batch_size ?? 30,
auto_download_new_mailboxes: currentRow.auto_download_new_mailboxes ?? true,
};
};
@@ -293,6 +297,7 @@ export function AccountActionDialog({ currentRow, open, onOpenChange }: Props) {
folder_limit: data.folder_limit,
download_interval_min: data.download_interval_min,
download_batch_size: data.download_batch_size,
auto_download_new_mailboxes: data.auto_download_new_mailboxes,
};
if (isEdit) {
const isAllMode = !data.date_since && !data.date_before;
@@ -232,6 +232,24 @@ export default function Step3() {
<hr className="my-4" />
<FormField
control={control}
name="auto_download_new_mailboxes"
render={({ field }) => (
<FormItem className="flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4 shadow-sm">
<FormControl>
<Checkbox checked={field.value} onCheckedChange={field.onChange} />
</FormControl>
<div className="space-y-1 leading-none">
<FormLabel>{t('accounts.autoDownloadNewMailboxes')}</FormLabel>
<FormDescription>{t('accounts.autoDownloadNewMailboxesDescription')}</FormDescription>
</div>
</FormItem>
)}
/>
<hr className="my-4" />
<FormField
control={control}
name="folder_limit"
@@ -168,6 +168,11 @@ export default function Step4() {
<AccordionTrigger className="font-medium capitalize text-gray-600">{t('accounts.downloadBatchSize')}:</AccordionTrigger>
<AccordionContent>{summaryData.download_batch_size}</AccordionContent>
</AccordionItem>
<AccordionItem key="auto_download_new_mailboxes" value="auto_download_new_mailboxes">
<AccordionTrigger className="font-medium capitalize text-gray-600">{t('accounts.autoDownloadNewMailboxes')}:</AccordionTrigger>
<AccordionContent>{summaryData.auto_download_new_mailboxes ? t('common.yes') : t('common.no')}</AccordionContent>
</AccordionItem>
</Accordion>
</div>
);
+1
View File
@@ -100,6 +100,7 @@
"auth": "المصادقة",
"authType": "نوع_المصادقة",
"autoConfiguring": "جارٍ التكوين التلقائي...",
"autoDownloadNewMailboxesDescription": "إضافة المجلدات الجديدة المكتشفة تلقائيًا إلى قائمة التنزيل.",
"beforeRelative": "تنزيل رسائل البريد الإلكتروني القديمة فقط",
"beforeRelativeValue": "تنزيل رسائل البريد الإلكتروني قبل {{value}} {{unit}} مضت",
"cancelDownload": "إلغاء التنزيل",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Godkendelse",
"authType": "godkendelsestype",
"autoConfiguring": "Konfigurerer automatisk...",
"autoDownloadNewMailboxesDescription": "Føj automatisk nye mapper til downloadlisten.",
"beforeRelative": "Download kun gamle e-mails",
"beforeRelativeValue": "Download e-mails før {{value}} {{unit}} siden",
"cancelDownload": "Annuller download",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Authentifizierung",
"authType": "Authentifizierungstyp",
"autoConfiguring": "Automatische Konfiguration läuft...",
"autoDownloadNewMailboxesDescription": "Neu entdeckte Ordner automatisch zur Download-Liste hinzufügen.",
"beforeRelative": "Nur alte E-Mails herunterladen",
"beforeRelativeValue": "E-Mails von vor {{value}} {{unit}} herunterladen",
"cancelDownload": "Download abbrechen",
+2
View File
@@ -100,6 +100,8 @@
"auth": "Auth",
"authType": "auth_type",
"autoConfiguring": "Auto-configuring...",
"autoDownloadNewMailboxes": "Auto-add new mailboxes",
"autoDownloadNewMailboxesDescription": "Automatically add newly discovered folders to the download list.",
"beforeRelative": "Download Old Emails Only",
"beforeRelativeValue": "Download emails before {{value}} {{unit}} ago",
"cancelDownload": "Cancel download",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Autenticación",
"authType": "tipo de autenticación",
"autoConfiguring": "Autoconfigurando...",
"autoDownloadNewMailboxesDescription": "Añadir automáticamente las nuevas carpetas a la lista de descarga.",
"beforeRelative": "Descargar solo correos antiguos",
"beforeRelativeValue": "Descargar correos de hace {{value}} {{unit}}",
"cancelDownload": "Cancelar descarga",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Todennus",
"authType": "todennustyyppi",
"autoConfiguring": "Automaattinen määritys...",
"autoDownloadNewMailboxesDescription": "Lisää uudet löydetyt kansiot automaattisesti latausluetteloon.",
"beforeRelative": "Lataa vain vanhat sähköpostit",
"beforeRelativeValue": "Lataa sähköpostit {{value}} {{unit}} sitten",
"cancelDownload": "Peruuta lataus",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Auth.",
"authType": "type_auth",
"autoConfiguring": "Configuration automatique...",
"autoDownloadNewMailboxesDescription": "Ajouter automatiquement les nouveaux dossiers à la liste de téléchargement.",
"beforeRelative": "Télécharger uniquement les anciens e-mails",
"beforeRelativeValue": "Télécharger les e-mails d'il y a {{value}} {{unit}}",
"cancelDownload": "Annuler le téléchargement",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Autenticazione",
"authType": "tipo_autenticazione",
"autoConfiguring": "Configurazione automatica...",
"autoDownloadNewMailboxesDescription": "Aggiungi automaticamente le nuove cartelle all'elenco di download.",
"beforeRelative": "Scarica solo le vecchie email",
"beforeRelativeValue": "Scarica email da {{value}} {{unit}} fa",
"cancelDownload": "Annulla download",
+1
View File
@@ -100,6 +100,7 @@
"auth": "認証",
"authType": "認証タイプ",
"autoConfiguring": "自動設定中...",
"autoDownloadNewMailboxesDescription": "新しく見つかったフォルダーを自動的にダウンロード一覧に追加します。",
"beforeRelative": "古いメールのみダウンロード",
"beforeRelativeValue": "{{value}} {{unit}}前より古いメールをダウンロード",
"cancelDownload": "ダウンロードをキャンセル",
+1
View File
@@ -100,6 +100,7 @@
"auth": "인증",
"authType": "인증 유형",
"autoConfiguring": "자동 구성 중...",
"autoDownloadNewMailboxesDescription": "새로 발견된 폴더를 다운로드 목록에 자동으로 추가합니다.",
"beforeRelative": "이전 이메일만 다운로드",
"beforeRelativeValue": "{{value}} {{unit}} 전의 이메일 다운로드",
"cancelDownload": "다운로드 취소",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Authenticatie",
"authType": "authenticatie_type",
"autoConfiguring": "Automatisch configureren...",
"autoDownloadNewMailboxesDescription": "Voeg automatisch nieuw ontdekte mappen toe aan de downloadlijst.",
"beforeRelative": "Download alleen oude e-mails",
"beforeRelativeValue": "Download e-mails van {{value}} {{unit}} geleden",
"cancelDownload": "Download annuleren",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Autentisering",
"authType": "autentiseringstype",
"autoConfiguring": "Konfigurerer automatisk...",
"autoDownloadNewMailboxesDescription": "Legg automatisk til nye mapper i nedlastingslisten.",
"beforeRelative": "Last ned kun gamle e-poster",
"beforeRelativeValue": "Last ned e-poster fra {{value}} {{unit}} siden",
"cancelDownload": "Avbryt nedlasting",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Auth",
"authType": "auth_type",
"autoConfiguring": "Auto konfiguracja...",
"autoDownloadNewMailboxesDescription": "Automatycznie dodawaj nowo wykryte foldery do listy pobierania.",
"beforeRelative": "Pobierz tylko stare e-maile",
"beforeRelativeValue": "Pobierz e-maile sprzed {{value}} {{unit}}",
"cancelDownload": "Anuluj pobieranie",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Autenticação",
"authType": "Tipo de Autenticação",
"autoConfiguring": "Configurando Automaticamente...",
"autoDownloadNewMailboxesDescription": "Adicionar automaticamente novas pastas à lista de download.",
"beforeRelative": "Baixar apenas e-mails antigos",
"beforeRelativeValue": "Baixar e-mails de {{value}} {{unit}} atrás",
"cancelDownload": "Cancelar download",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Авторизация",
"authType": "тип_авторизации",
"autoConfiguring": "Автонастройка...",
"autoDownloadNewMailboxesDescription": "Автоматически добавлять новые папки в список загрузки.",
"beforeRelative": "Скачать только старые письма",
"beforeRelativeValue": "Скачать письма за {{value}} {{unit}} назад",
"cancelDownload": "Отменить загрузку",
+1
View File
@@ -100,6 +100,7 @@
"auth": "Auth",
"authType": "auth_typ",
"autoConfiguring": "Konfigurerar automatiskt...",
"autoDownloadNewMailboxesDescription": "Lägg automatiskt till nya mappar i hämtningslistan.",
"beforeRelative": "Ladda ner endast gamla e-postmeddelanden",
"beforeRelativeValue": "Ladda ner e-post från {{value}} {{unit}} sedan",
"cancelDownload": "Avbryt hämtning",
+1
View File
@@ -100,6 +100,7 @@
"auth": "驗證",
"authType": "驗證類型",
"autoConfiguring": "正在自動設定...",
"autoDownloadNewMailboxesDescription": "自動將新發現的郵件夾添加到下載列表中。",
"beforeRelative": "僅下載舊郵件",
"beforeRelativeValue": "下載 {{value}} {{unit}} 之前的郵件",
"cancelDownload": "取消下載",
+2
View File
@@ -100,6 +100,8 @@
"auth": "认证",
"authType": "认证类型",
"autoConfiguring": "自动配置中...",
"autoDownloadNewMailboxes": "自动添加新邮件夹",
"autoDownloadNewMailboxesDescription": "自动将新发现的邮件夹添加到下载列表中。",
"beforeRelative": "仅下载旧邮件",
"beforeRelativeValue": "下载 {{value}} {{unit}} 之前的邮件",
"cancelDownload": "取消下载",