mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 06:46:32 +03:00
Suppress welcome device messages after account import
Add dummy `devmsglabels` entries on import to avoid welcome messages being added when user runs reconfiguration on imported account.
This commit is contained in:
@@ -1306,6 +1306,7 @@ impl Context {
|
||||
mod tests {
|
||||
use num_traits::ToPrimitive;
|
||||
|
||||
use crate::chat::delete_and_reset_all_device_msgs;
|
||||
use crate::chat::Chat;
|
||||
use crate::chatlist::Chatlist;
|
||||
use crate::test_utils::TestContext;
|
||||
@@ -1471,7 +1472,17 @@ mod tests {
|
||||
assert_eq!(chats.len(), 0);
|
||||
|
||||
// a subsequent call to update_device_chats() must not re-add manally deleted messages or chats
|
||||
t.update_device_chats().await.ok();
|
||||
t.update_device_chats().await.unwrap();
|
||||
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
||||
assert_eq!(chats.len(), 0);
|
||||
|
||||
// Reset all device messages. This normally happens due to account export and import.
|
||||
// Check that update_device_chats() does not add welcome message for imported account.
|
||||
delete_and_reset_all_device_msgs(&t).await.unwrap();
|
||||
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
||||
assert_eq!(chats.len(), 0);
|
||||
|
||||
t.update_device_chats().await.unwrap();
|
||||
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
||||
assert_eq!(chats.len(), 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user