diff --git a/src/chat.rs b/src/chat.rs index 7da941d31..494da8083 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -2235,8 +2235,9 @@ pub struct ChatInfo { } pub(crate) async fn update_saved_messages_icon(context: &Context) -> Result<()> { - // if there is no saved-messages chat, there is nothing to update. this is no error. - if let Some(chat_id) = ChatId::lookup_by_contact(context, ContactId::SELF).await? { + if let Some(ChatIdBlocked { id: chat_id, .. }) = + ChatIdBlocked::lookup_by_contact(context, ContactId::SELF).await? + { let icon = include_bytes!("../assets/icon-saved-messages.png"); let blob = BlobObject::create(context, "icon-saved-messages.png", icon).await?; let icon = blob.as_name().to_string(); @@ -2249,8 +2250,9 @@ pub(crate) async fn update_saved_messages_icon(context: &Context) -> Result<()> } pub(crate) async fn update_device_icon(context: &Context) -> Result<()> { - // if there is no device-chat, there is nothing to update. this is no error. - if let Some(chat_id) = ChatId::lookup_by_contact(context, ContactId::DEVICE).await? { + if let Some(ChatIdBlocked { id: chat_id, .. }) = + ChatIdBlocked::lookup_by_contact(context, ContactId::DEVICE).await? + { let icon = include_bytes!("../assets/icon-device.png"); let blob = BlobObject::create(context, "icon-device.png", icon).await?; let icon = blob.as_name().to_string(); diff --git a/src/config.rs b/src/config.rs index 3394b7a2a..a367494aa 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1007,6 +1007,15 @@ mod tests { .set_config(Config::Selfavatar, Some(file.to_str().unwrap())) .await?; sync(&alice0, &alice1).await; + // There was a bug that a sync message creates the self-chat with the user avatar instead of + // the special icon and that remains so when the self-chat becomes user-visible. Let's check + // this. + let self_chat = alice0.get_self_chat().await; + let self_chat_avatar_path = self_chat.get_profile_image(&alice0).await?.unwrap(); + assert_eq!( + self_chat_avatar_path, + alice0.get_blobdir().join("icon-saved-messages.png") + ); assert!(alice1 .get_config(Config::Selfavatar) .await?