Allow blocking sender from junk folder

pull/190/head
M66B 4 years ago
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 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);

@ -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);
}

Loading…
Cancel
Save