mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
Fix contact name update rules
The following rules apply now: 1. "name" column is only updated manually and never over the network 2. "authname" column is only updated over the network and never manually 3. Displayname is a "name" if it is non-empty, otherwise it is "authname". This fixes a known (pytest.xfail) problem of "name" being changed over the network when user has set it to non-empty string manually. This also fixes the problem when "name" and "authname" became unsynchronized accidentally, when they were equal and then Origin::IncomingUnknownTo update arrived, setting "name" but not "authname". Rust regression test is added for this case.
This commit is contained in:
@@ -2422,13 +2422,9 @@ mod tests {
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
Contact::load_from_db(&t, carl_contact_id)
|
||||
.await
|
||||
.unwrap()
|
||||
.get_name(),
|
||||
"h2"
|
||||
);
|
||||
let contact = Contact::load_from_db(&t, carl_contact_id).await.unwrap();
|
||||
assert_eq!(contact.get_name(), "");
|
||||
assert_eq!(contact.get_display_name(), "h2");
|
||||
|
||||
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
||||
let msg = Message::load_from_db(&t, chats.get_msg_id(0).unwrap())
|
||||
@@ -2471,13 +2467,9 @@ mod tests {
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
Contact::load_from_db(&t, carl_contact_id)
|
||||
.await
|
||||
.unwrap()
|
||||
.get_name(),
|
||||
"Carl"
|
||||
);
|
||||
let contact = Contact::load_from_db(&t, carl_contact_id).await.unwrap();
|
||||
assert_eq!(contact.get_name(), "");
|
||||
assert_eq!(contact.get_display_name(), "Carl");
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
|
||||
Reference in New Issue
Block a user