From 1cabc0cac92a4558d62b35ac25a7b057893094d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 13 Oct 2020 09:47:49 +0200 Subject: [PATCH] crypto: Correctly store the uploaded key count when saving the account. This fixes: #101. --- matrix_sdk_crypto/src/store/sqlite.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/matrix_sdk_crypto/src/store/sqlite.rs b/matrix_sdk_crypto/src/store/sqlite.rs index 17c525c2..fe67e2d6 100644 --- a/matrix_sdk_crypto/src/store/sqlite.rs +++ b/matrix_sdk_crypto/src/store/sqlite.rs @@ -1219,7 +1219,8 @@ impl CryptoStore for SqliteStore { ) VALUES (?1, ?2, ?3, ?4, ?5) ON CONFLICT(user_id, device_id) DO UPDATE SET pickle = excluded.pickle, - shared = excluded.shared + shared = excluded.shared, + uploaded_key_count = excluded.uploaded_key_count ", ) .bind(pickle.user_id.as_str()) @@ -1612,6 +1613,7 @@ mod test { .expect("Can't save account"); account.mark_as_shared(); + account.update_uploaded_key_count(50); store .save_account(account.clone()) @@ -1622,6 +1624,10 @@ mod test { let loaded_account = loaded_account.unwrap(); assert_eq!(account, loaded_account); + assert_eq!( + account.uploaded_key_count(), + loaded_account.uploaded_key_count() + ); } #[tokio::test]