From a810ea96ed3d248a284d2faa2dffa8cd0b0adf43 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 4 Jan 2021 14:08:34 +0100 Subject: [PATCH] Prevent auto classification out of the spam folder --- FAQ.md | 3 +++ app/src/main/java/eu/faircode/email/MessageClassifier.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index a76b4c1c2f..ff9fe97c38 100644 --- a/FAQ.md +++ b/FAQ.md @@ -3432,6 +3432,9 @@ You can clear local messages (long press a folder in the folder list of an accou Moving a message on the device will reclassify the message. Moving a message from another email client will not result in reclassification because IMAP does not support 'moved' notifications. +To prevent the email server from moving a message into the spam folder again, +auto classification out of the spam folder will be prevented to prevent an endless loop. + Classification is optimized to use as little resources as possible, but will inevitably use some extra battery power. You can delete all classification data by turning classification three times off. diff --git a/app/src/main/java/eu/faircode/email/MessageClassifier.java b/app/src/main/java/eu/faircode/email/MessageClassifier.java index 0399805d2b..d89bfdc035 100644 --- a/app/src/main/java/eu/faircode/email/MessageClassifier.java +++ b/app/src/main/java/eu/faircode/email/MessageClassifier.java @@ -111,7 +111,9 @@ public class MessageClassifier { db.beginTransaction(); EntityFolder target = db.folder().getFolderByName(account.id, classified); - if (target != null && !target.id.equals(folder.id) && target.auto_classify && + if (target != null && target.auto_classify && + !target.id.equals(folder.id) && + !EntityFolder.JUNK.equals(folder.type) && (EntityFolder.JUNK.equals(target.type) || ActivityBilling.isPro(context))) { EntityOperation.queue(context, message, EntityOperation.MOVE, target.id, false, true);