Allow blocking sender from junk folder

This commit is contained in:
M66B 2020-12-09 10:26:45 +01:00
parent 8c01aa712e
commit 34200a3121
2 changed files with 12 additions and 2 deletions

View File

@ -1628,7 +1628,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean archive = (move && (hasArchive && !inArchive && !inSent && !inTrash && !inJunk));
boolean trash = (move || outbox || debug ||
message.accountProtocol == EntityAccount.TYPE_POP);
boolean junk = (move && (hasJunk && !inJunk));
boolean junk = (move && hasJunk);
boolean inbox = (move && (inArchive || inTrash || inJunk));
boolean keywords = (!message.folderReadOnly && message.uid != null &&
message.accountProtocol == EntityAccount.TYPE_IMAP);

View File

@ -6954,10 +6954,20 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (junk == null)
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) {
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)
rule.id = db.rule().insertRule(rule);
}