Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Emit MsgsNoticed on receipt of an IMAP-seen message #6351

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/receive_imf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,9 @@ pub(crate) async fn receive_imf_inner(
chat_id.emit_msg_event(context, *msg_id, mime_parser.incoming && fresh);
}
}
if received_msg.state == MessageState::InSeen {
context.emit_event(EventType::MsgsNoticed(chat_id));
}
context.new_msgs_notify.notify_one();

mime_parser
Expand Down
25 changes: 25 additions & 0 deletions src/receive_imf/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,31 @@ async fn test_adhoc_groups_merge() -> Result<()> {
Ok(())
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_msgs_noticed_on_seen_msg() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let seen = true;
let rcvd_msg = receive_imf(
alice,
b"From: [email protected]\n\
To: [email protected]\n\
Message-ID: <[email protected]>\n\
Date: Sun, 22 Mar 2020 22:37:57 +0000\n\
\n\
This is a seen message.\n",
seen,
)
.await?
.unwrap();
let ev = alice
.evtracker
.get_matching(|e| matches!(e, EventType::MsgsNoticed { .. }))
.await;
assert_eq!(ev, EventType::MsgsNoticed(rcvd_msg.chat_id));
Ok(())
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_read_receipt_and_unarchive() -> Result<()> {
// create alice's account
Expand Down
Loading