Commit Graph

13223 Commits

Author SHA1 Message Date
Valere
789bd317b3 Merge pull request #4383 from matrix-org/valere/cache_dehydration_pickle_key
feat(crypto): Support storing the dehydrated device pickle key
2024-12-13 14:42:44 +01:00
Valere
2b39476d9b feat(crypto): Support storing the dehydrated device pickle key 2024-12-13 13:05:19 +01:00
Andy Balaam
6dcefe49c2 feat(utds): Provide the reason why an event was an expected UTD 2024-12-13 10:46:10 +00:00
Benjamin Bouvier
150d9e4b05 fix(event cache store): always use immediate mode when handling linked chunk updates
If a linked chunk update starts with a RemoveChunk update, then the
transaction may start with a SELECT query and be considered a read
transaction. Soon enough, it will be upgraded into a write transaction,
because of the next UPDATE/DELETE operations that happen thereafter. If
there's another write transaction already happening, this may result in
a SQLITE_BUSY error, according to
https://www.sqlite.org/lang_transaction.html#deferred_immediate_and_exclusive_transactions

One solution is to always start the transaction in immediate mode. This
may also fail with SQLITE_BUSY according to the documentation, but it's
unclear whether it will happen in general, since we're using WAL mode
too. Let's try it out.
2024-12-12 17:59:42 +01:00
Damir Jelić
54bd1d7931 refactor(base): Move the joined member count logic into its respective sub-functions 2024-12-12 14:44:21 +01:00
Damir Jelić
7ae31d0cb1 fix(base): Subtract the number of service members from the number joined members
This patch fixes an edge case where the member is alone in the room with
a service member. We already subtracted the number of service members
in the case we calculated the room summary ourselves, but we did not do
so when the server provided the room summary.

This lead to the room, instead of being called `Empty`, being called
`Foo and N others`.
2024-12-12 14:44:21 +01:00
Damir Jelić
f7f58dfd71 feat(ui): Add the MemberHints state event type to the required state
This state event allows us to correctly calculate the room display name
according to MSC4171.

MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/4171
2024-12-12 14:44:21 +01:00
Richard van der Hoff
780a4630e4 chore(ffi): avoid hardcoding clang version
Update the workaround for https://github.com/rust-lang/rust/issues/109717 to
avoid hardcoding the clang version; instead, run `clang -dumpversion` to figure
it out.

While we're there, use the `CC_x86_64-linux-android` env var, which should
point to clang, rather than relying on `ANDROID_NDK_HOME` to be set.
2024-12-12 12:54:00 +00:00
Benjamin Bouvier
3356e0cc82 refactor(state store): use a single lock for all memory store accesses
The `MemoryStore` implementation of the `StateStore` has grown into a
monster, with one lock per field. It's probably overkill, as individual
fields don't need fine-grained locks like this; after all, accesses to
the store shouldn't be reentrant in general.

Fixes #3720.
2024-12-12 10:04:09 +01:00
Richard van der Hoff
fda374ee81 feat(ffi): Add new properties to UnableToDecryptInfo
Followup to https://github.com/matrix-org/matrix-rust-sdk/pull/4360: expose
the new properties via FFI
2024-12-11 18:42:28 +00:00
Benjamin Bouvier
0264e49968 task(event cache): rename a few things
- rename RawLinkedChunk -> RawChunk
- rename RawChunk::id -> RawChunk::identifier
- precise that a `RawChunk` is mostly a `Chunk` with different
previous/next links.
2024-12-11 12:10:24 +01:00
Benjamin Bouvier
d42c449612 refactor(event cache): only store a prev-batch token if the timeline was limited 2024-12-11 12:10:24 +01:00
Benjamin Bouvier
925d10f2ff task(event cache store): include the number of added items in one log 2024-12-11 12:10:24 +01:00
Benjamin Bouvier
4402f59e74 refactor(event cache): spawn a task to handle updates to the event cache store 2024-12-11 12:10:24 +01:00
Benjamin Bouvier
20184552a8 feat(event cache): start with an empty linked chunk if reloading failed 2024-12-11 12:10:24 +01:00
Benjamin Bouvier
832fedb05e feat(event cache): display raw linked chunks from storage when they fail to be rebuilt 2024-12-11 12:10:24 +01:00
Benjamin Bouvier
eeb14f6cbe refactor!(event cache store): have the event cache store return raw linked chunks, not the full linked chunk
And let the caller rebuild the linked chunk. This is slightly nicer in
that it allows us to display the raw representation of a reloaded linked
chunk, before checking its internal state is consistent; this will allow
for better debug of issues related to the linked chunk internal state.

No functional changes.
2024-12-11 12:10:24 +01:00
Kévin Commaille
a562f73b1e doc(timeline): Document media caching of send_attachment
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-12-11 10:45:39 +01:00
Kévin Commaille
7295f29055 doc(send_queue): Document media caching of send_attachment
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-12-11 10:45:39 +01:00
Kévin Commaille
723d7973d5 fix(send_queue): Use MediaFormat::File when caching attachment thumbnail
The `MediaFormat` reflects only the request that would be made to the homeserver.
There is no link between the format of the files stored in the media cache and their purpose in an event.

`MediaFormat::Tumbnail` means that we request a server-generated thumbnail of a file in the media repository.

Since the thumbnail is its own file in the media repository, it makes more sense to use `MediaFormat::File`.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-12-11 10:45:39 +01:00
Stefan Ceriu
d5e7a9c949 chore(ui): rename date divider is_same_date_as to is_same_date_divider_group_as 2024-12-10 14:11:48 +02:00
Stefan Ceriu
8f064581d6 chore(ui): rename the day_dividers module to date_dividers 2024-12-10 14:11:48 +02:00
Stefan Ceriu
634edf2b65 chore(ui): rename all timeline "day dividers" to "date deviders" following the introduction of montly divider mode 2024-12-10 14:11:48 +02:00
Stefan Ceriu
935e4df927 feat(ui): make the timeline date separators configurable; have them appear either when the day changes or when the month changes. 2024-12-10 14:11:48 +02:00
Richard van der Hoff
1d72d2774f feat(ui): Add more properties to UnableToDecryptInfo 2024-12-10 11:36:04 +00:00
Richard van der Hoff
1e72131e7f feat(ui) Add UnableToDecryptInfo::user_trusts_own_identity 2024-12-10 11:36:04 +00:00
Richard van der Hoff
e8b3949db3 feat(ui): Add UnableToDecryptInfo::event_local_age_millis 2024-12-10 11:36:04 +00:00
Richard van der Hoff
c501a39ad4 refactor(sdk): Add Encryption::device_creation_timestamp
... so that we can use it in more places
2024-12-10 11:36:04 +00:00
Richard van der Hoff
a04f9187f8 refactor(ui): store UTD info within PendingUtdReport
... making it easier to report late decryptions.
2024-12-10 11:36:04 +00:00
Benjamin Bouvier
32e2070f56 refactor(ffi): use a bool instead of an option to make the API less awkward
By default, the event cache store will be disabled. If disabled, it will
clean all the events in the cache store; most of the time this will do
nothing, since the store will not even be filled with any event data, so
it would be cheap to do. If some data was filled in the cache store
before, then it would be cleared after the cache store has been
disabled.

This makes a less awkward API than the previous one, where `None` and
`Some(false)` carried different semantics.
2024-12-10 12:05:29 +01:00
Benjamin Bouvier
4ee96aaffc feat(event cache): add a way to clear a single room's persistent storage 2024-12-10 12:05:29 +01:00
Benjamin Bouvier
0783cf89ba feat(ffi): add a feature flag to enable persistent storage for the event cache 2024-12-10 12:05:29 +01:00
Benjamin Bouvier
cf02e694f2 feat(event cache store): add a method to clear all rooms' linked chunks 2024-12-10 12:05:29 +01:00
Ivan Enderlin
cf178d603c doc(ui): Fix typos. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
ee94c86164 doc(ui): Fix a typo. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
3526761580 doc(ui): Unfold a Self in the doc. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
9a08975c8e doc(ui): Explain why ObservableItemsEntries does not implement Iterator. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
6b56c9efd8 doc(ui): Explain why Deref is fine, but DerefMut is not. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
0f2ada0958 refactor(ui): Rename ObservableItems::clone to clone_items. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
0d17ea353f refactor(ui): Replace a panic by a sensible value + error!. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
13e26b13e7 doc(ui): Rephrase the documentation of ObservableItems::all_remote_events. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
72f1bd6180 doc(ui): Document ObservableItems::items more and TimelineItemKind. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
e32ea1627e doc(ui): Fix typos. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
ed1f2e29ed refactor(ui): ObservableItemsTransactionEntry::remove is no longer unsafe 2024-12-10 11:36:05 +01:00
Ivan Enderlin
92cb18207e test(ui): Write test suite for ObservableItems. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
80f6b8d2cd test(ui): Write test suite for AllRemoteEvents.
This patch adds test suite for `AllRemoteEvents`.
2024-12-10 11:36:05 +01:00
Ivan Enderlin
05969fefde chore: Make Clippy happy. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
81c962238a doc(ui): Add more documentation for AllRemoteEvents. 2024-12-10 11:36:05 +01:00
Ivan Enderlin
56218ee5d7 refactor(ui): Create ObservableItemsTransactionEntry.
This patch creates `ObservableItemsTransactionEntry` that mimics
`ObservableVectorTransactionEntry`. The differences are `set` is
renamed `replace`, and `remove` is unsafe (because I failed to update
`AllRemoteEvents` in this method due to the borrow checker).
2024-12-10 11:36:05 +01:00
Ivan Enderlin
aa9138b281 doc(ui): Add more documentation for ObservableItemsTransaction. 2024-12-10 11:36:05 +01:00