From 1127184db237f5d4cc4c30480c8ccabb8bcd5229 Mon Sep 17 00:00:00 2001 From: Michael Goldenberg Date: Sat, 4 Oct 2025 10:20:56 -0400 Subject: [PATCH] refactor(indexeddb): add transaction fn for putting media into IndexedDB Signed-off-by: Michael Goldenberg --- crates/matrix-sdk-indexeddb/src/media_store/transaction.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/matrix-sdk-indexeddb/src/media_store/transaction.rs b/crates/matrix-sdk-indexeddb/src/media_store/transaction.rs index 312aea64c..7749c710a 100644 --- a/crates/matrix-sdk-indexeddb/src/media_store/transaction.rs +++ b/crates/matrix-sdk-indexeddb/src/media_store/transaction.rs @@ -225,6 +225,12 @@ impl<'a> IndexeddbMediaStoreTransaction<'a> { self.add_item(media).await } + /// Puts [`Media`] in IndexedDB object. If an item with the same key already + /// exists, it will be overwritten. + pub async fn put_media(&self, media: &Media) -> Result<(), TransactionError> { + self.put_item(media).await + } + /// Adds [`Media`] to IndexedDB if the size of [`IndexedMedia::content`][1] /// does not exceed [`MediaRetentionPolicy::max_file_size]. If an item with /// the same key already exists, it will be overwritten.