-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Mark reactions as IMAP-seen in marknoticed_chat() (#6210)
When a reaction notification is shown in the UIs, there's an option "Mark Read", but the UIs are unaware of reactions message ids, so the UIs just call `marknoticed_chat()` in this case. We don't want to introduce reactions message ids to the UIs (at least currently), but let's make received reactions `InFresh` so that the existing `\Seen` flag synchronisation mechanism works for them, and mark the last fresh hidden incoming message (reaction) in the chat as seen in `chat::marknoticed_chat()` to trigger emitting `MsgsNoticed` on other devices. There's a problem though that another device may have more reactions received and not yet seen notifications are removed from it when handling `MsgsNoticed`, but the same problem already exists for "usual" messages, so let's not solve it for now.
- Loading branch information
Showing
5 changed files
with
121 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -397,7 +397,7 @@ mod tests { | |
use deltachat_contact_tools::ContactAddress; | ||
|
||
use super::*; | ||
use crate::chat::{forward_msgs, get_chat_msgs, send_text_msg}; | ||
use crate::chat::{forward_msgs, get_chat_msgs, marknoticed_chat, send_text_msg}; | ||
use crate::chatlist::Chatlist; | ||
use crate::config::Config; | ||
use crate::contact::{Contact, Origin}; | ||
|
@@ -664,7 +664,7 @@ Here's my footer -- [email protected]" | |
|
||
let bob_reaction_msg = bob.pop_sent_msg().await; | ||
let alice_reaction_msg = alice.recv_msg_hidden(&bob_reaction_msg).await; | ||
assert_eq!(alice_reaction_msg.state, MessageState::InSeen); | ||
assert_eq!(alice_reaction_msg.state, MessageState::InFresh); | ||
assert_eq!(get_chat_msgs(&alice, chat_alice.id).await?.len(), 2); | ||
|
||
let reactions = get_msg_reactions(&alice, alice_msg.sender_msg_id).await?; | ||
|
@@ -681,6 +681,20 @@ Here's my footer -- [email protected]" | |
expect_incoming_reactions_event(&alice, alice_msg.sender_msg_id, *bob_id, "👍").await?; | ||
expect_no_unwanted_events(&alice).await; | ||
|
||
marknoticed_chat(&alice, chat_alice.id).await?; | ||
assert_eq!( | ||
alice_reaction_msg.id.get_state(&alice).await?, | ||
MessageState::InSeen | ||
); | ||
// Reactions don't request MDNs. | ||
assert_eq!( | ||
alice | ||
.sql | ||
.count("SELECT COUNT(*) FROM smtp_mdns", ()) | ||
.await?, | ||
0 | ||
); | ||
|
||
// Alice reacts to own message. | ||
send_reaction(&alice, alice_msg.sender_msg_id, "👍 😀") | ||
.await | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters