mirror of https://github.com/M66B/FairEmail.git
Prevent classification loop
This commit is contained in:
parent
b45e85a7bc
commit
d35f04d668
|
@ -189,7 +189,7 @@ public class EntityOperation {
|
|||
autounflag = false;
|
||||
}
|
||||
|
||||
boolean auto_classified = false;
|
||||
boolean auto_classified = message.auto_classified;
|
||||
if (jargs.opt(2) != null) {
|
||||
auto_classified = jargs.getBoolean(2);
|
||||
jargs.remove(2);
|
||||
|
|
|
@ -94,7 +94,8 @@ public class MessageClassifier {
|
|||
" message=" + message.id +
|
||||
"@" + new Date(message.received) +
|
||||
":" + message.subject +
|
||||
" class=" + classified);
|
||||
" class=" + classified +
|
||||
" re=" + message.auto_classified);
|
||||
|
||||
Integer m = classMessages.get(account.id).get(folder.name);
|
||||
if (target == null) {
|
||||
|
@ -108,21 +109,23 @@ public class MessageClassifier {
|
|||
|
||||
dirty = true;
|
||||
|
||||
if (classified != null) {
|
||||
EntityFolder f = db.folder().getFolderByName(account.id, classified);
|
||||
if (f != null && !f.id.equals(folder.id) && f.auto_classify &&
|
||||
(EntityFolder.JUNK.equals(f.type) || ActivityBilling.isPro(context)))
|
||||
try {
|
||||
db.beginTransaction();
|
||||
if (classified != null && !message.auto_classified)
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
EntityFolder f = db.folder().getFolderByName(account.id, classified);
|
||||
if (f != null && !f.id.equals(folder.id) && f.auto_classify &&
|
||||
(EntityFolder.JUNK.equals(f.type) || ActivityBilling.isPro(context))) {
|
||||
|
||||
EntityOperation.queue(context, message, EntityOperation.MOVE, f.id, false, true);
|
||||
message.ui_hide = true;
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue