mirror of https://github.com/M66B/FairEmail.git
Fixed enabling junk filter for non inbox folders
This commit is contained in:
parent
24d74fb0ac
commit
bba731e1e5
|
@ -162,33 +162,36 @@ public class FragmentDialogJunk extends FragmentDialogBase {
|
|||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
||||
long account = args.getLong("account");
|
||||
long aid = args.getLong("account");
|
||||
long fid = args.getLong("folder");
|
||||
boolean filter = args.getBoolean("filter");
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
EntityFolder inbox = db.folder().getFolderByType(account, EntityFolder.INBOX);
|
||||
if (inbox == null)
|
||||
EntityFolder folder = db.folder().getFolder(fid);
|
||||
if (folder == null)
|
||||
return null;
|
||||
|
||||
EntityFolder junk = db.folder().getFolderByType(account, EntityFolder.JUNK);
|
||||
EntityFolder junk = db.folder().getFolderByType(aid, EntityFolder.JUNK);
|
||||
if (junk == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
db.folder().setFolderDownload(
|
||||
inbox.id, inbox.download || filter);
|
||||
db.folder().setFolderAutoClassify(
|
||||
inbox.id, inbox.auto_classify_source || filter, inbox.auto_classify_target);
|
||||
db.folder().setFolderDownload(folder.id,
|
||||
folder.download || filter);
|
||||
db.folder().setFolderAutoClassify(folder.id,
|
||||
folder.auto_classify_source || filter,
|
||||
folder.auto_classify_target);
|
||||
|
||||
db.folder().setFolderDownload(
|
||||
junk.id, junk.download || filter);
|
||||
db.folder().setFolderAutoClassify(
|
||||
junk.id, junk.auto_classify_source || filter, filter);
|
||||
db.folder().setFolderDownload(junk.id,
|
||||
junk.download || filter);
|
||||
db.folder().setFolderAutoClassify(junk.id,
|
||||
junk.auto_classify_source || filter,
|
||||
filter);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
|
@ -251,22 +254,23 @@ public class FragmentDialogJunk extends FragmentDialogBase {
|
|||
|
||||
@Override
|
||||
protected Boolean onExecute(Context context, Bundle args) throws Throwable {
|
||||
long account = args.getLong("account");
|
||||
long aid = args.getLong("account");
|
||||
long fid = args.getLong("folder");
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean classification = prefs.getBoolean("classification", false);
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
EntityFolder inbox = db.folder().getFolderByType(account, EntityFolder.INBOX);
|
||||
if (inbox == null)
|
||||
return false;
|
||||
EntityFolder folder = db.folder().getFolder(fid);
|
||||
if (folder == null)
|
||||
return null;
|
||||
|
||||
EntityFolder junk = db.folder().getFolderByType(account, EntityFolder.JUNK);
|
||||
EntityFolder junk = db.folder().getFolderByType(aid, EntityFolder.JUNK);
|
||||
if (junk == null)
|
||||
return false;
|
||||
return null;
|
||||
|
||||
return (classification &&
|
||||
inbox.download && inbox.auto_classify_source &&
|
||||
folder.download && folder.auto_classify_source &&
|
||||
junk.download && junk.auto_classify_source && junk.auto_classify_target);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue