mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
fix: emit MsgsChanged event with correct chat id for replaced messages
Previously an event with DC_CHAT_ID_TRASH was emitted.
This commit is contained in:
@@ -376,6 +376,11 @@ def test_webxdc_download_on_demand(acfactory, data, lp):
|
|||||||
ac2._evtracker.get_matching("DC_EVENT_WEBXDC_STATUS_UPDATE")
|
ac2._evtracker.get_matching("DC_EVENT_WEBXDC_STATUS_UPDATE")
|
||||||
assert msg2.get_status_updates()
|
assert msg2.get_status_updates()
|
||||||
|
|
||||||
|
# Get a event notifying that the message disappeared from the chat.
|
||||||
|
msgs_changed_event = ac2._evtracker.get_matching("DC_EVENT_MSGS_CHANGED")
|
||||||
|
assert msgs_changed_event.data1 == msg2.chat.id
|
||||||
|
assert msgs_changed_event.data2 == 0
|
||||||
|
|
||||||
|
|
||||||
def test_mvbox_sentbox_threads(acfactory, lp):
|
def test_mvbox_sentbox_threads(acfactory, lp):
|
||||||
lp.sec("ac1: start with mvbox thread")
|
lp.sec("ac1: start with mvbox thread")
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ pub(crate) async fn receive_imf_inner(
|
|||||||
|
|
||||||
// check, if the mail is already in our database.
|
// check, if the mail is already in our database.
|
||||||
// make sure, this check is done eg. before securejoin-processing.
|
// make sure, this check is done eg. before securejoin-processing.
|
||||||
let replace_partial_download =
|
let (replace_partial_download, replace_chat_id) =
|
||||||
if let Some(old_msg_id) = message::rfc724_mid_exists(context, rfc724_mid).await? {
|
if let Some(old_msg_id) = message::rfc724_mid_exists(context, rfc724_mid).await? {
|
||||||
let msg = Message::load_from_db(context, old_msg_id).await?;
|
let msg = Message::load_from_db(context, old_msg_id).await?;
|
||||||
if msg.download_state() != DownloadState::Done && is_partial_download.is_none() {
|
if msg.download_state() != DownloadState::Done && is_partial_download.is_none() {
|
||||||
@@ -152,14 +152,14 @@ pub(crate) async fn receive_imf_inner(
|
|||||||
context,
|
context,
|
||||||
"Message already partly in DB, replacing by full message."
|
"Message already partly in DB, replacing by full message."
|
||||||
);
|
);
|
||||||
Some(old_msg_id)
|
(Some(old_msg_id), Some(msg.chat_id))
|
||||||
} else {
|
} else {
|
||||||
// the message was probably moved around.
|
// the message was probably moved around.
|
||||||
info!(context, "Message already in DB, doing nothing.");
|
info!(context, "Message already in DB, doing nothing.");
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
(None, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
let prevent_rename =
|
let prevent_rename =
|
||||||
@@ -347,8 +347,8 @@ pub(crate) async fn receive_imf_inner(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if replace_partial_download.is_some() {
|
if let Some(replace_chat_id) = replace_chat_id {
|
||||||
context.emit_msgs_changed(chat_id, MsgId::new(0));
|
context.emit_msgs_changed(replace_chat_id, MsgId::new(0));
|
||||||
} else if !chat_id.is_trash() {
|
} else if !chat_id.is_trash() {
|
||||||
let fresh = received_msg.state == MessageState::InFresh;
|
let fresh = received_msg.state == MessageState::InFresh;
|
||||||
for msg_id in &received_msg.msg_ids {
|
for msg_id in &received_msg.msg_ids {
|
||||||
|
|||||||
Reference in New Issue
Block a user