Skip to content

Commit 266cc9f

Browse files
committed
Try removing imap::Session::sync_seen_flags()
1 parent 0f0b012 commit 266cc9f

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

deltachat-rpc-client/tests/test_something.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,35 @@ def test_reaction_seen_on_another_dev(acfactory) -> None:
431431
assert chat_id == alice2_chat_bob.id
432432

433433

434+
def test_2nd_device_events_when_msgs_are_seen(acfactory) -> None:
435+
alice, bob = acfactory.get_online_accounts(2)
436+
alice2 = alice.clone()
437+
alice2.start_io()
438+
439+
# Get an accepted chat, otherwise alice2 won't be notified about the 2nd message.
440+
chat_alice2 = alice2.create_chat(bob)
441+
chat_id_alice2 = chat_alice2.get_basic_snapshot().id
442+
443+
chat_bob_alice = bob.create_chat(alice)
444+
chat_bob_alice.send_text("Hello!")
445+
msg_alice = alice.wait_for_incoming_msg()
446+
assert alice2.wait_for_incoming_msg_event().chat_id == chat_id_alice2
447+
chat_bob_alice.send_text("What's new?")
448+
assert alice2.wait_for_incoming_msg_event().chat_id == chat_id_alice2
449+
chat_alice2 = alice2.get_chat_by_id(chat_id_alice2)
450+
assert chat_alice2.get_fresh_message_count() == 2
451+
452+
msg_alice.mark_seen()
453+
assert alice2.wait_for_msgs_changed_event().chat_id == chat_id_alice2
454+
assert chat_alice2.get_fresh_message_count() == 1
455+
456+
msg_id = alice.wait_for_msgs_changed_event().msg_id
457+
msg = alice.get_message_by_id(msg_id)
458+
msg.mark_seen()
459+
assert alice2.wait_for_event(EventType.MSGS_NOTICED).chat_id == chat_id_alice2
460+
assert chat_alice2.get_fresh_message_count() == 0
461+
462+
434463
def test_is_bot(acfactory) -> None:
435464
"""Test that we can recognize messages submitted by bots."""
436465
alice, bob = acfactory.get_online_accounts(2)

src/imap.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ impl Session {
12061206
}
12071207

12081208
/// Synchronizes `\Seen` flags using `CONDSTORE` extension.
1209+
#[allow(dead_code)]
12091210
pub(crate) async fn sync_seen_flags(&mut self, context: &Context, folder: &str) -> Result<()> {
12101211
if !self.can_condstore() {
12111212
info!(

src/scheduler.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,6 @@ async fn fetch_idle(
602602
}
603603
}
604604

605-
// Synchronize Seen flags.
606-
session
607-
.sync_seen_flags(ctx, &watch_folder)
608-
.await
609-
.context("sync_seen_flags")
610-
.log_err(ctx)
611-
.ok();
612-
613605
connection.connectivity.set_idle(ctx);
614606

615607
ctx.emit_event(EventType::ImapInboxIdle);

0 commit comments

Comments
 (0)