add "reset all processed" button + endpoint
POST /api/filters/reset-all-processed drops and recreates the processed_mails table — sekundenschnell auch bei Millionen Zeilen via DROP+CREATE (same pattern as the fast clear-logs). Safe because already-moved mails are no longer in the source folder, so a fresh re-evaluation cannot re-move them, only pick up ones that were skipped due to a rule bug (e.g. the has_attachment fix). Button "Alle Regeln zurücksetzen" next to "Neue Regel" on the filter list, with a confirmation dialog and result feedback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -224,6 +224,8 @@ function renderFilters() {
|
||||
let html = `
|
||||
<div style="display:flex; gap:0.75rem; align-items:center; margin-bottom:1rem; flex-wrap:wrap;">
|
||||
<button onclick="openNewFilter()" style="margin-bottom:0;">Neue Regel</button>
|
||||
<button class="outline" onclick="resetAllProcessed()" title="Verwirft den 'verarbeitet'-Marker aller Mails. Beim nächsten Poll werden alle Ordner-Mails neu gegen alle Regeln geprüft. Sicher — schon verschobene Mails sind nicht mehr in der Quelle."
|
||||
style="margin-bottom:0;">Alle Regeln zurücksetzen</button>
|
||||
<input type="search" id="filter-search" placeholder="Filter durchsuchen..."
|
||||
value="${searchTerm.replace(/"/g, '"')}"
|
||||
oninput="renderFilters()"
|
||||
@@ -530,6 +532,23 @@ async function deleteFilter(id) {
|
||||
loadFilters();
|
||||
}
|
||||
|
||||
async function resetAllProcessed() {
|
||||
if (!confirm('Alle Mails werden beim nächsten Poll erneut von allen Regeln geprüft. Fortfahren?')) return;
|
||||
try {
|
||||
const resp = await fetch('/api/filters/reset-all-processed', {method: 'POST'});
|
||||
const text = await resp.text();
|
||||
let data = null;
|
||||
try { data = JSON.parse(text); } catch {}
|
||||
if (!resp.ok) {
|
||||
alert('Fehler: ' + (data?.detail || text || `HTTP ${resp.status}`));
|
||||
return;
|
||||
}
|
||||
alert(`${data?.reset ?? 0} Einträge zurückgesetzt. Beim nächsten Poll (max ~1-2 min) wird alles neu geprüft.`);
|
||||
} catch(e) {
|
||||
alert('Netzwerk-Fehler: ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Ordner-Browser (Baumansicht) ---
|
||||
|
||||
let folderTargetInputName = null;
|
||||
|
||||
Reference in New Issue
Block a user