From cbd23db2fe870f767f84bc9dfa06b20dfd35d531 Mon Sep 17 00:00:00 2001
From: Linus Rath <139418639+rathlinus@users.noreply.github.com>
Date: Sun, 1 Nov 2026 07:05:02 +0100
Subject: [PATCH] fix: give mail import and export their own settings section
and name the upload limit as the server does
- Settings > Backup & reset gets a Mail files section for Import mail
and Export all mail, instead of sitting under settings backup.
- The pause message names Stalwart's 50000000-byte quota as 50 MB, not
48 MB, and the dialog and settings texts mention .ost files.
- The old import's leftovers go: expandImportableEmails and
EML_IMPORT_ACCEPT in lib/eml-import.ts, and the strings
email_viewer.import_email, mailbox_context_menu.import_email and
notifications.import_email_success/_error in all 30 locales.
lib/__tests__/eml-import.test.ts loses the tests of the removed
functions; its #891 checks that an .eml and an .eml in a ZIP keep their
Date header now run against the import's own sources.
---
.../__tests__/transfer-progress.test.ts | 8 +++
.../mail-transfer/mail-backup-settings.tsx | 8 +--
.../mail-transfer/mail-import-dialog.tsx | 4 +-
.../mail-transfer/transfer-progress.tsx | 5 ++
components/settings/about-data-settings.tsx | 4 +-
lib/__tests__/eml-import.test.ts | 69 +++++--------------
lib/eml-import.ts | 57 ---------------
locales/ar/common.json | 12 ++--
locales/ca/common.json | 12 ++--
locales/cs/common.json | 12 ++--
locales/da/common.json | 12 ++--
locales/de/common.json | 12 ++--
locales/en/common.json | 12 ++--
locales/es/common.json | 12 ++--
locales/et/common.json | 12 ++--
locales/fa/common.json | 12 ++--
locales/fr/common.json | 12 ++--
locales/he/common.json | 12 ++--
locales/hu/common.json | 12 ++--
locales/it/common.json | 12 ++--
locales/ja/common.json | 12 ++--
locales/ko/common.json | 12 ++--
locales/lv/common.json | 12 ++--
locales/mn/common.json | 12 ++--
locales/nb/common.json | 12 ++--
locales/nl/common.json | 12 ++--
locales/pl/common.json | 12 ++--
locales/pt/common.json | 12 ++--
locales/ro/common.json | 12 ++--
locales/ru/common.json | 12 ++--
locales/sk/common.json | 12 ++--
locales/th/common.json | 12 ++--
locales/tr/common.json | 12 ++--
locales/uk/common.json | 12 ++--
locales/vi/common.json | 12 ++--
locales/zh-TW/common.json | 12 ++--
locales/zh/common.json | 12 ++--
37 files changed, 188 insertions(+), 327 deletions(-)
create mode 100644 components/mail-transfer/__tests__/transfer-progress.test.ts
diff --git a/components/mail-transfer/__tests__/transfer-progress.test.ts b/components/mail-transfer/__tests__/transfer-progress.test.ts
new file mode 100644
index 000000000..0701429fc
--- /dev/null
+++ b/components/mail-transfer/__tests__/transfer-progress.test.ts
@@ -0,0 +1,8 @@
+import { describe, it, expect } from 'vitest';
+import { serverMegabytes } from '@/components/mail-transfer/transfer-progress';
+
+describe('serverMegabytes', () => {
+ it('names Stalwart\'s upload quota as the server does', () => {
+ expect(serverMegabytes(50_000_000)).toBe('50 MB');
+ });
+});
diff --git a/components/mail-transfer/mail-backup-settings.tsx b/components/mail-transfer/mail-backup-settings.tsx
index d1ba7eeaf..facc6e6e9 100644
--- a/components/mail-transfer/mail-backup-settings.tsx
+++ b/components/mail-transfer/mail-backup-settings.tsx
@@ -1,16 +1,16 @@
"use client";
import { useTranslations } from "next-intl";
-import { SettingItem } from "@/components/settings/settings-section";
+import { SettingItem, SettingsSection } from "@/components/settings/settings-section";
import { Button } from "@/components/ui/button";
import { openMailExport, openMailImport } from "@/stores/mail-transfer-store";
-/** Settings > Backup: bring mail in from files, and save all of it as one file. */
+/** Settings > Backup & reset > Mail files: bring mail in from files, and save all of it as one file. */
export function MailBackupSettings() {
const tImport = useTranslations("mail_import");
const tExport = useTranslations("mail_export");
return (
- <>
+
- >
+
);
}
diff --git a/components/mail-transfer/mail-import-dialog.tsx b/components/mail-transfer/mail-import-dialog.tsx
index aba661d07..f196ca97c 100644
--- a/components/mail-transfer/mail-import-dialog.tsx
+++ b/components/mail-transfer/mail-import-dialog.tsx
@@ -14,7 +14,7 @@ import { hasFolders, sniffFormat, type ImportFormat, type SkipReason } from "@/l
import type { ImportProgress } from "@/lib/mail-import/engine";
import type { Mailbox } from "@/lib/jmap/types";
import { formatFileSize, getMailboxPath } from "@/lib/utils";
-import { formatClock, TransferBar, useFocusOnStage } from "./transfer-progress";
+import { formatClock, serverMegabytes, TransferBar, useFocusOnStage } from "./transfer-progress";
import { startImport } from "./start-import";
const ACCEPT = ".eml,.zip,.mbox,.mbx,.pst,.ost,message/rfc822,application/zip,application/mbox";
@@ -288,7 +288,7 @@ function ProgressBody({ progress: p, t, locale, statusId }: { progress: ImportPr
if (p.phase === "paused" && p.pausedUntil) {
const time = formatClock(p.pausedUntil, locale);
status = p.quota?.files && p.quota.bytes
- ? t("paused", { time, files: p.quota.files, size: formatFileSize(p.quota.bytes) })
+ ? t("paused", { time, files: p.quota.files, size: serverMegabytes(p.quota.bytes) })
: t("paused_generic", { time });
} else if (running) {
status = p.fileName ? t("reading_file", { name: p.fileName }) : t("running_title");
diff --git a/components/mail-transfer/transfer-progress.tsx b/components/mail-transfer/transfer-progress.tsx
index 208810343..1363b9d9e 100644
--- a/components/mail-transfer/transfer-progress.tsx
+++ b/components/mail-transfer/transfer-progress.tsx
@@ -42,6 +42,11 @@ export function TransferBar({ fraction, label, paused }: { fraction: number | nu
);
}
+/** A server limit in the server's own unit: Stalwart's 50000000 bytes are "50 MB" (not the 48 MB of a 1024-based size). */
+export function serverMegabytes(bytes: number): string {
+ return `${Math.round(bytes / 1_000_000)} MB`;
+}
+
/** "14:00", or a date and time when the moment isn't today. */
export function formatClock(ms: number, locale: string, now = Date.now()): string {
const date = new Date(ms);
diff --git a/components/settings/about-data-settings.tsx b/components/settings/about-data-settings.tsx
index 692d0acad..17db44064 100644
--- a/components/settings/about-data-settings.tsx
+++ b/components/settings/about-data-settings.tsx
@@ -213,10 +213,10 @@ export function AboutDataSettings() {
>
)}
-
-
+
+