mirror of
https://github.com/chatmail/core.git
synced 2026-04-22 16:06:30 +03:00
feat: add IncomingReaction.chat_id (#6459)
For the same reasons as mentioned in #6356 and to streamline the "Incoming" Event API. (all have a chat_id)
This commit is contained in:
@@ -285,6 +285,7 @@ pub(crate) async fn set_msg_reaction(
|
||||
&& msg_id.get_state(context).await?.is_outgoing()
|
||||
{
|
||||
context.emit_event(EventType::IncomingReaction {
|
||||
chat_id,
|
||||
contact_id,
|
||||
msg_id,
|
||||
reaction,
|
||||
@@ -582,6 +583,7 @@ Here's my footer -- bob@example.net"
|
||||
|
||||
async fn expect_incoming_reactions_event(
|
||||
t: &TestContext,
|
||||
expected_chat_id: ChatId,
|
||||
expected_msg_id: MsgId,
|
||||
expected_contact_id: ContactId,
|
||||
expected_reaction: &str,
|
||||
@@ -599,10 +601,12 @@ Here's my footer -- bob@example.net"
|
||||
.await;
|
||||
match event {
|
||||
EventType::IncomingReaction {
|
||||
chat_id,
|
||||
msg_id,
|
||||
contact_id,
|
||||
reaction,
|
||||
} => {
|
||||
assert_eq!(chat_id, expected_chat_id);
|
||||
assert_eq!(msg_id, expected_msg_id);
|
||||
assert_eq!(contact_id, expected_contact_id);
|
||||
assert_eq!(reaction, Reaction::from(expected_reaction));
|
||||
@@ -677,7 +681,14 @@ Here's my footer -- bob@example.net"
|
||||
assert_eq!(bob_reaction.as_str(), "👍");
|
||||
expect_reactions_changed_event(&alice, chat_alice.id, alice_msg.sender_msg_id, *bob_id)
|
||||
.await?;
|
||||
expect_incoming_reactions_event(&alice, alice_msg.sender_msg_id, *bob_id, "👍").await?;
|
||||
expect_incoming_reactions_event(
|
||||
&alice,
|
||||
chat_alice.id,
|
||||
alice_msg.sender_msg_id,
|
||||
*bob_id,
|
||||
"👍",
|
||||
)
|
||||
.await?;
|
||||
expect_no_unwanted_events(&alice).await;
|
||||
|
||||
// Alice reacts to own message.
|
||||
@@ -720,8 +731,14 @@ Here's my footer -- bob@example.net"
|
||||
send_reaction(&bob, bob_msg1.id, "👍").await?;
|
||||
let bob_send_reaction = bob.pop_sent_msg().await;
|
||||
alice.recv_msg_trash(&bob_send_reaction).await;
|
||||
expect_incoming_reactions_event(&alice, alice_msg1.sender_msg_id, alice_bob_id, "👍")
|
||||
.await?;
|
||||
expect_incoming_reactions_event(
|
||||
&alice,
|
||||
alice_chat.id,
|
||||
alice_msg1.sender_msg_id,
|
||||
alice_bob_id,
|
||||
"👍",
|
||||
)
|
||||
.await?;
|
||||
expect_no_unwanted_events(&alice).await;
|
||||
|
||||
let chatlist = Chatlist::try_load(&bob, 0, None, None).await?;
|
||||
|
||||
Reference in New Issue
Block a user