mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Return default 'ALL' mailbox criterias for some imap servers
This commit is contained in:
parent
36b4fff5c7
commit
0ebe08d796
@ -384,6 +384,8 @@ def make_criterias(rule: MailRule, supports_gmail_labels: bool):
|
|||||||
if isinstance(rule_query, dict):
|
if isinstance(rule_query, dict):
|
||||||
if len(rule_query) or len(criterias):
|
if len(rule_query) or len(criterias):
|
||||||
return AND(**rule_query, **criterias)
|
return AND(**rule_query, **criterias)
|
||||||
|
else:
|
||||||
|
return "ALL"
|
||||||
else:
|
else:
|
||||||
return AND(rule_query, **criterias)
|
return AND(rule_query, **criterias)
|
||||||
|
|
||||||
|
@ -721,6 +721,31 @@ class TestMail(
|
|||||||
self.assertEqual(len(self.bogus_mailbox.messages), 2)
|
self.assertEqual(len(self.bogus_mailbox.messages), 2)
|
||||||
self.assertEqual(len(self.bogus_mailbox.messages_spam), 1)
|
self.assertEqual(len(self.bogus_mailbox.messages_spam), 1)
|
||||||
|
|
||||||
|
def test_handle_mail_account_move_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.MOVE,
|
||||||
|
action_parameter="spam",
|
||||||
|
maximum_age=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(len(self.bogus_mailbox.messages), 3)
|
||||||
|
self.assertEqual(len(self.bogus_mailbox.messages_spam), 0)
|
||||||
|
|
||||||
|
self.mail_account_handler.handle_mail_account(account)
|
||||||
|
self.apply_mail_actions()
|
||||||
|
|
||||||
|
self.assertEqual(len(self.bogus_mailbox.messages), 0)
|
||||||
|
self.assertEqual(len(self.bogus_mailbox.messages_spam), 3)
|
||||||
|
|
||||||
def test_handle_mail_account_tag(self):
|
def test_handle_mail_account_tag(self):
|
||||||
account = MailAccount.objects.create(
|
account = MailAccount.objects.create(
|
||||||
name="test",
|
name="test",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user