feat: Deduplicate in more places (#6464)

Deduplicate:
- In the REPL
- In `store_from_base64()`, which writes avatars received in headers
- In a few tests
- The saved messages, broadcast, device, archive icons
- The autocrypt setup message

1-2 more PRs, and we can get rid of `BlobObject::create`,
`sanitise_name()`, and some others
This commit is contained in:
Hocuri
2025-01-22 17:25:57 +01:00
committed by link2xt
parent 744cab1553
commit 3959305b4a
10 changed files with 43 additions and 55 deletions

View File

@@ -1415,9 +1415,10 @@ impl Context {
// add welcome-messages. by the label, this is done only once,
// if the user has deleted the message or the chat, it is not added again.
let image = include_bytes!("../assets/welcome-image.jpg");
let blob = BlobObject::create(self, "welcome-image.jpg", image).await?;
let blob = BlobObject::create_and_deduplicate_from_bytes(self, image, "welcome.jpg")?;
let mut msg = Message::new(Viewtype::Image);
msg.param.set(Param::File, blob.as_name());
msg.param.set(Param::Filename, "welcome-image.jpg");
chat::add_device_msg(self, Some("core-welcome-image"), Some(&mut msg)).await?;
let mut msg = Message::new_text(welcome_message(self).await);