Prevent classification loop

pull/190/head
M66B 4 years ago
parent b45e85a7bc
commit d35f04d668

@ -189,7 +189,7 @@ public class EntityOperation {
autounflag = false; autounflag = false;
} }
boolean auto_classified = false; boolean auto_classified = message.auto_classified;
if (jargs.opt(2) != null) { if (jargs.opt(2) != null) {
auto_classified = jargs.getBoolean(2); auto_classified = jargs.getBoolean(2);
jargs.remove(2); jargs.remove(2);

@ -94,7 +94,8 @@ public class MessageClassifier {
" message=" + message.id + " message=" + message.id +
"@" + new Date(message.received) + "@" + new Date(message.received) +
":" + message.subject + ":" + message.subject +
" class=" + classified); " class=" + classified +
" re=" + message.auto_classified);
Integer m = classMessages.get(account.id).get(folder.name); Integer m = classMessages.get(account.id).get(folder.name);
if (target == null) { if (target == null) {
@ -108,21 +109,23 @@ public class MessageClassifier {
dirty = true; dirty = true;
if (classified != null) { if (classified != null && !message.auto_classified)
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 { try {
db.beginTransaction(); 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); EntityOperation.queue(context, message, EntityOperation.MOVE, f.id, false, true);
message.ui_hide = true; message.ui_hide = true;
}
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }
}
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }

Loading…
Cancel
Save