feat: do not replace avatar for address-contact profiles

Key-contacts and address-contacts do not appear
in the same lists in the UI, so there is no need
to distinguish between the two.

Letter icon is renamed from "address contact icon"
to "unencrypted chat icon" to make it clear
that the icon distinguishes unencrypted chats
from encrypted chats as it is also used for
unencrypted group chats and is most helpful
in the chatlists where a mix of encrypted
and unencrypted chats is displayed.
This commit is contained in:
link2xt
2025-08-08 01:15:27 +00:00
parent 80af012962
commit c16b29b126
4 changed files with 9 additions and 23 deletions

View File

@@ -1771,6 +1771,12 @@ impl Chat {
return Ok(Some(get_device_icon(context).await?));
} else if self.is_self_talk() {
return Ok(Some(get_saved_messages_icon(context).await?));
} else if !self.is_encrypted(context).await? {
// This is an unencrypted chat, show a special avatar that marks it as such.
return Ok(Some(get_abs_path(
context,
Path::new(&get_unencrypted_chat_icon(context).await?),
)));
} else if self.typ == Chattype::Single {
// For 1:1 chats, we always use the same avatar as for the contact
// This is before the `self.is_encrypted()` check, because that function
@@ -1780,12 +1786,6 @@ impl Chat {
let contact = Contact::get_by_id(context, *contact_id).await?;
return contact.get_profile_image(context).await;
}
} else if !self.is_encrypted(context).await? {
// This is an address-contact chat, show a special avatar that marks it as such
return Ok(Some(get_abs_path(
context,
Path::new(&get_address_contact_icon(context).await?),
)));
} else if let Some(image_rel) = self.param.get(Param::ProfileImage) {
// Load the group avatar, or the device-chat / saved-messages icon
if !image_rel.is_empty() {
@@ -2490,11 +2490,11 @@ pub(crate) async fn get_archive_icon(context: &Context) -> Result<PathBuf> {
.await
}
pub(crate) async fn get_address_contact_icon(context: &Context) -> Result<PathBuf> {
pub(crate) async fn get_unencrypted_chat_icon(context: &Context) -> Result<PathBuf> {
get_asset_icon(
context,
"icon-address-contact",
include_bytes!("../assets/icon-address-contact.png"),
include_bytes!("../assets/icon-unencrypted-chat.png"),
)
.await
}