diff --git a/python/tests/test_1_online.py b/python/tests/test_1_online.py index c8526e68d..33909b8db 100644 --- a/python/tests/test_1_online.py +++ b/python/tests/test_1_online.py @@ -1755,12 +1755,12 @@ def test_group_quote(acfactory, lp): "xyz", False, "xyz", - ), # Test that emails are recognized in a random folder but not moved + ), # Test that emails aren't found in a random folder ( - "xyz", + "Spam", True, "DeltaChat", - ), # ...emails are found in a random folder and moved to DeltaChat + ), # ...emails are moved from the spam folder to "DeltaChat" ( "Spam", False, @@ -1785,7 +1785,7 @@ def test_scan_folders(acfactory, lp, folder, move, expected_destination): ac1.stop_io() assert folder in ac1.direct_imap.list_folders() - lp.sec("Send a message to from ac2 to ac1 and manually move it to the mvbox") + lp.sec("Send a message to from ac2 to ac1 and manually move it to `folder`") ac1.direct_imap.select_config_folder("inbox") with ac1.direct_imap.idle() as idle1: acfactory.get_accepted_chat(ac2, ac1).send_text("hello") @@ -1795,10 +1795,17 @@ def test_scan_folders(acfactory, lp, folder, move, expected_destination): lp.sec("start_io() and see if DeltaChat finds the message (" + variant + ")") ac1.set_config("scan_all_folders_debounce_secs", "0") ac1.start_io() - msg = ac1._evtracker.wait_next_incoming_message() - assert msg.text == "hello" + chat = ac1.create_chat(ac2) + n_msgs = 1 # "Messages are end-to-end encrypted." + if folder == "Spam": + msg = ac1._evtracker.wait_next_incoming_message() + assert msg.text == "hello" + n_msgs += 1 + else: + ac1._evtracker.wait_idle_inbox_ready() + assert len(chat.get_messages()) == n_msgs - # The message has been downloaded, which means it has reached its destination. + # The message has reached its destination. ac1.direct_imap.select_folder(expected_destination) assert len(ac1.direct_imap.get_all_messages()) == 1 if folder != expected_destination: diff --git a/src/imap.rs b/src/imap.rs index ea6d90736..6cb361068 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -814,7 +814,10 @@ impl Session { .context("listing folders for resync")?; for folder in all_folders { let folder_meaning = get_folder_meaning(&folder); - if folder_meaning != FolderMeaning::Virtual { + if !matches!( + folder_meaning, + FolderMeaning::Virtual | FolderMeaning::Unknown | FolderMeaning::Drafts + ) { self.resync_folder_uids(context, folder.name(), folder_meaning) .await?; } diff --git a/src/imap/scan_folders.rs b/src/imap/scan_folders.rs index 860c27568..5793c6f51 100644 --- a/src/imap/scan_folders.rs +++ b/src/imap/scan_folders.rs @@ -75,6 +75,7 @@ impl Imap { if !watched_folders.contains(&folder.name().to_string()) && folder_meaning != FolderMeaning::Drafts && folder_meaning != FolderMeaning::Trash + && folder_meaning != FolderMeaning::Unknown { self.fetch_move_delete(context, session, folder.name(), folder_meaning) .await