mirror of https://github.com/M66B/FairEmail.git
Allow blocking sender from junk folder
This commit is contained in:
parent
8c01aa712e
commit
34200a3121
|
@ -1628,7 +1628,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
boolean archive = (move && (hasArchive && !inArchive && !inSent && !inTrash && !inJunk));
|
boolean archive = (move && (hasArchive && !inArchive && !inSent && !inTrash && !inJunk));
|
||||||
boolean trash = (move || outbox || debug ||
|
boolean trash = (move || outbox || debug ||
|
||||||
message.accountProtocol == EntityAccount.TYPE_POP);
|
message.accountProtocol == EntityAccount.TYPE_POP);
|
||||||
boolean junk = (move && (hasJunk && !inJunk));
|
boolean junk = (move && hasJunk);
|
||||||
boolean inbox = (move && (inArchive || inTrash || inJunk));
|
boolean inbox = (move && (inArchive || inTrash || inJunk));
|
||||||
boolean keywords = (!message.folderReadOnly && message.uid != null &&
|
boolean keywords = (!message.folderReadOnly && message.uid != null &&
|
||||||
message.accountProtocol == EntityAccount.TYPE_IMAP);
|
message.accountProtocol == EntityAccount.TYPE_IMAP);
|
||||||
|
|
|
@ -6954,10 +6954,20 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
if (junk == null)
|
if (junk == null)
|
||||||
throw new IllegalArgumentException(context.getString(R.string.title_no_junk_folder));
|
throw new IllegalArgumentException(context.getString(R.string.title_no_junk_folder));
|
||||||
|
|
||||||
EntityOperation.queue(context, message, EntityOperation.MOVE, junk.id);
|
if (!message.folder.equals(junk.id))
|
||||||
|
EntityOperation.queue(context, message, EntityOperation.MOVE, junk.id);
|
||||||
|
|
||||||
if (block_sender || block_domain) {
|
if (block_sender || block_domain) {
|
||||||
EntityRule rule = EntityRule.blockSender(context, message, junk, block_domain, whitelist);
|
EntityRule rule = EntityRule.blockSender(context, message, junk, block_domain, whitelist);
|
||||||
|
if (rule != null) {
|
||||||
|
if (message.folder.equals(junk.id)) {
|
||||||
|
EntityFolder inbox = db.folder().getFolderByType(message.account, EntityFolder.INBOX);
|
||||||
|
if (inbox == null)
|
||||||
|
rule = null;
|
||||||
|
else
|
||||||
|
rule.folder = inbox.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (rule != null)
|
if (rule != null)
|
||||||
rule.id = db.rule().insertRule(rule);
|
rule.id = db.rule().insertRule(rule);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue