-
-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Labels
bugSomething is not workingSomething is not working
Description
- Operating System (Linux/Mac/Windows/iOS/Android): All
- Core Version: v2.17.0
- Client Version: 2.15.0
Expected behavior
"Share contact" VCard color is the same as the eventual contact's color when you start a chat with that contact.
Actual behavior
The colors are different.
Steps to reproduce the problem
- Share a contact that has no avatar in a chat.
Screenshots
The bug exists since 9af00af (#7134). The VCard color and contact color used to be the same, str_to_color(addr.to_lowercase()), but fell out of sync.
| let color = color::str_to_color(&vc.addr.to_lowercase()); |
Lines 1577 to 1588 in af58b86
| /// Get a color for the contact. | |
| /// The color is calculated from the contact's fingerprint (for key-contacts) | |
| /// or email address (for address-contacts) and can be used | |
| /// for an fallback avatar with white initials | |
| /// as well as for headlines in bubbles of group chats. | |
| pub fn get_color(&self) -> u32 { | |
| if let Some(fingerprint) = self.fingerprint() { | |
| str_to_color(&fingerprint.hex()) | |
| } else { | |
| str_to_color(&self.addr.to_lowercase()) | |
| } | |
| } |
It would have been easy to fix, but apparently VCard doesn't have the "fingerprint" property, only a key:
core/deltachat-contact-tools/src/vcard.rs
Lines 12 to 27 in 7ec7329
| /// A Contact, as represented in a VCard. | |
| pub struct VcardContact { | |
| /// The email address, vcard property `email` | |
| pub addr: String, | |
| /// This must be the name authorized by the contact itself, not a locally given name. Vcard | |
| /// property `fn`. Can be empty, one should use `display_name()` to obtain the display name. | |
| pub authname: String, | |
| /// The contact's public PGP key in Base64, vcard property `key` | |
| pub key: Option<String>, | |
| /// The contact's profile image (=avatar) in Base64, vcard property `photo` | |
| pub profile_image: Option<String>, | |
| /// The biography, stored in the vcard property `note` | |
| pub biography: Option<String>, | |
| /// The timestamp when the vcard was created / last updated, vcard property `rev` | |
| pub timestamp: Result<i64>, | |
| } |
I'm not sure if it's worth recalculating the fingerprint every time, or maybe it's better to store it together with the key.
Lines 339 to 355 in af58b86
| let fingerprint; | |
| if let Some(public_key) = key { | |
| fingerprint = public_key.dc_fingerprint().hex(); | |
| context | |
| .sql | |
| .execute( | |
| "INSERT INTO public_keys (fingerprint, public_key) | |
| VALUES (?, ?) | |
| ON CONFLICT (fingerprint) | |
| DO NOTHING", | |
| (&fingerprint, public_key.to_bytes()), | |
| ) | |
| .await?; | |
| } else { | |
| fingerprint = String::new(); | |
| } |
iequidoo and Simon-Laux
Metadata
Metadata
Assignees
Labels
bugSomething is not workingSomething is not working