-
-
Notifications
You must be signed in to change notification settings - Fork 87
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, moreover there are no `msgs` rows for incoming reactions in the core, 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 usual messages, just hidden and `InFresh`, so that the existing `\Seen` flag synchronisation mechanism works for them, and mark all incoming hidden messages in the chat as seen in `marknoticed_chat()`. It's interesting that sent out reactions are already hidden messages, so this change mostly just unifies things.
- Loading branch information
Showing
6 changed files
with
118 additions
and
39 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}; | ||
|
@@ -663,7 +663,8 @@ Here's my footer -- [email protected]" | |
assert_eq!(get_chat_msgs(&bob, bob_msg.chat_id).await?.len(), 2); | ||
|
||
let bob_reaction_msg = bob.pop_sent_msg().await; | ||
alice.recv_msg_trash(&bob_reaction_msg).await; | ||
let alice_reaction_msg = alice.recv_msg_hidden(&bob_reaction_msg).await; | ||
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?; | ||
|
@@ -680,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 | ||
|
@@ -719,7 +734,7 @@ Here's my footer -- [email protected]" | |
bob_msg1.chat_id.accept(&bob).await?; | ||
send_reaction(&bob, bob_msg1.id, "👍").await?; | ||
let bob_send_reaction = bob.pop_sent_msg().await; | ||
alice.recv_msg_trash(&bob_send_reaction).await; | ||
alice.recv_msg_hidden(&bob_send_reaction).await; | ||
expect_incoming_reactions_event(&alice, alice_msg1.sender_msg_id, alice_bob_id, "👍") | ||
.await?; | ||
expect_no_unwanted_events(&alice).await; | ||
|
@@ -882,7 +897,7 @@ Here's my footer -- [email protected]" | |
let bob_reaction_msg = bob.pop_sent_msg().await; | ||
|
||
// Alice receives a reaction. | ||
alice.recv_msg_trash(&bob_reaction_msg).await; | ||
alice.recv_msg_hidden(&bob_reaction_msg).await; | ||
|
||
let reactions = get_msg_reactions(&alice, alice_msg_id).await?; | ||
assert_eq!(reactions.to_string(), "👍1"); | ||
|
@@ -934,7 +949,7 @@ Here's my footer -- [email protected]" | |
{ | ||
send_reaction(&alice2, alice2_msg.id, "👍").await?; | ||
let msg = alice2.pop_sent_msg().await; | ||
alice1.recv_msg_trash(&msg).await; | ||
alice1.recv_msg_hidden(&msg).await; | ||
} | ||
|
||
// Check that the status is still the same. | ||
|
@@ -956,7 +971,7 @@ Here's my footer -- [email protected]" | |
let alice1_msg = alice1.recv_msg(&alice0.pop_sent_msg().await).await; | ||
|
||
send_reaction(&alice0, alice0_msg_id, "👀").await?; | ||
alice1.recv_msg_trash(&alice0.pop_sent_msg().await).await; | ||
alice1.recv_msg_hidden(&alice0.pop_sent_msg().await).await; | ||
|
||
expect_reactions_changed_event(&alice0, chat_id, alice0_msg_id, ContactId::SELF).await?; | ||
expect_reactions_changed_event(&alice1, alice1_msg.chat_id, alice1_msg.id, ContactId::SELF) | ||
|
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