mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Handle delete mail action with no filters
This commit is contained in:
parent
405769dc97
commit
434d1fe225
@ -381,7 +381,8 @@ def make_criterias(rule):
|
|||||||
|
|
||||||
rule_query = get_rule_action(rule).get_criteria()
|
rule_query = get_rule_action(rule).get_criteria()
|
||||||
if isinstance(rule_query, dict):
|
if isinstance(rule_query, dict):
|
||||||
return AND(**rule_query, **criterias)
|
if len(rule_query) != 0 or len(criterias) != 0:
|
||||||
|
return AND(**rule_query, **criterias)
|
||||||
else:
|
else:
|
||||||
return AND(rule_query, **criterias)
|
return AND(rule_query, **criterias)
|
||||||
|
|
||||||
|
@ -612,6 +612,29 @@ class TestMail(
|
|||||||
|
|
||||||
self.assertEqual(len(self.bogus_mailbox.messages), 1)
|
self.assertEqual(len(self.bogus_mailbox.messages), 1)
|
||||||
|
|
||||||
|
def test_handle_mail_account_delete_no_filters(self):
|
||||||
|
|
||||||
|
account = MailAccount.objects.create(
|
||||||
|
name="test",
|
||||||
|
imap_server="",
|
||||||
|
username="admin",
|
||||||
|
password="secret",
|
||||||
|
)
|
||||||
|
|
||||||
|
_ = MailRule.objects.create(
|
||||||
|
name="testrule",
|
||||||
|
account=account,
|
||||||
|
action=MailRule.MailAction.DELETE,
|
||||||
|
maximum_age=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(len(self.bogus_mailbox.messages), 3)
|
||||||
|
|
||||||
|
self.mail_account_handler.handle_mail_account(account)
|
||||||
|
self.apply_mail_actions()
|
||||||
|
|
||||||
|
self.assertEqual(len(self.bogus_mailbox.messages), 0)
|
||||||
|
|
||||||
def test_handle_mail_account_flag(self):
|
def test_handle_mail_account_flag(self):
|
||||||
account = MailAccount.objects.create(
|
account = MailAccount.objects.create(
|
||||||
name="test",
|
name="test",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user