feat(mail): E-Mail ignorieren, wenn im Import-Wizard alles ignoriert wird
Build and Push Multi-Platform Images / build-and-push (push) Successful in 23s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 23s
Stehen im Wizard alle Dokumente auf „Ignorieren“ (durch die Duplikatprüfung oder vom Benutzer gewählt), gibt es nichts zu importieren. „Weiter“ markiert die E-Mail dann als ignoriert, informiert den Benutzer und schließt den Wizard. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
acb9076944
commit
a72e41611d
1 file changed
+25
@@ -5,6 +5,7 @@ import {
|
|||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import { emailImportApi, type AttachmentImportData } from '../api/email-import';
|
import { emailImportApi, type AttachmentImportData } from '../api/email-import';
|
||||||
|
import { emailsApi } from '../api/emails';
|
||||||
import { paperlessApi, type PaperlessCorrespondent } from '../api/paperless';
|
import { paperlessApi, type PaperlessCorrespondent } from '../api/paperless';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import {
|
import {
|
||||||
@@ -328,8 +329,32 @@ export default function MailImportWizard({ visible, onClose, onSuccess, email, a
|
|||||||
setCurrentStep(currentStep - 1);
|
setCurrentStep(currentStep - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Alle Dokumente stehen auf "Ignorieren" (Duplikat oder vom Benutzer
|
||||||
|
// gewählt): Es gibt nichts zu importieren, die E-Mail wird ignoriert.
|
||||||
|
const ignoreEmail = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
await emailsApi.ignore(email.Id);
|
||||||
|
message.info(
|
||||||
|
importData.every(i => i.isDuplicate)
|
||||||
|
? 'Alle Dokumente dieser E-Mail sind bereits vorhanden – die E-Mail wird als ignoriert markiert.'
|
||||||
|
: 'Alle Dokumente stehen auf „Ignorieren“ – die E-Mail wird als ignoriert markiert.'
|
||||||
|
);
|
||||||
|
(onSuccess ?? onClose)();
|
||||||
|
} catch (e) {
|
||||||
|
const err = e as { response?: { data?: { message?: string } }; message?: string };
|
||||||
|
message.error(`E-Mail konnte nicht als ignoriert markiert werden: ${err.response?.data?.message ?? err.message}`);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const nextStep = async () => {
|
const nextStep = async () => {
|
||||||
if (currentStep === 0) {
|
if (currentStep === 0) {
|
||||||
|
if (importData.length > 0 && importData.every(i => i.type === 'IGNORE')) {
|
||||||
|
await ignoreEmail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
await loadBelegnummern();
|
await loadBelegnummern();
|
||||||
} else if (currentStep === 1) {
|
} else if (currentStep === 1) {
|
||||||
// Vor dem Abrufen der Belegnummern erneut prüfen, damit für ein
|
// Vor dem Abrufen der Belegnummern erneut prüfen, damit für ein
|
||||||
|
|||||||
Reference in new issue
Block a user