Commit Graph

8769 Commits

Author SHA1 Message Date
Michael Goldenberg
6e034b0d7b refactor(indexeddb): add transaction fn for getting the size of the media cache
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-10 10:09:52 +02:00
Michael Goldenberg
e4a717dff5 refactor(indexeddb): add media-specific transaction fns for getting and operating on keys
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-10 10:09:52 +02:00
Michael Goldenberg
6acf628fc5 refactor(indexeddb): import cursor direction enum from indexed_db_futures rather than web_sys
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-10 10:09:52 +02:00
Michael Goldenberg
db91bb35ee refactor(indexeddb): add transaction fns for getting and operating on keys
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-10 10:09:52 +02:00
Michael Goldenberg
3b7dbf5c04 feat(indexeddb): add IndexedDB-backed impl for MediaStoreInner::last_media_cleanup_time_inner
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-10 10:09:52 +02:00
Michael Goldenberg
22bfe8fbd3 refactor(indexeddb): add fns to get and put media cleanup time
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-10 10:09:52 +02:00
Michael Goldenberg
e4243b7af3 refactor(indexeddb): add indexed type and traits for media cleanup time
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-10 10:09:52 +02:00
Michael Goldenberg
f891c1ca06 refactor(indexeddb): add type for representing media cleanup time
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-10 10:09:52 +02:00
Michael Goldenberg
c2839d7594 refactor(indexeddb): add conversions and operations for UnixTime
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-10 10:09:52 +02:00
Kévin Commaille
cb3d281f8f Upgrade Ruma after removal of legacy mention push rules
The legacy mention push rules were removed, and the
`contains_display_name` condition was deprecated.

Some tests check for backwards-compatibility with legacy mentions, so we
need to add them back for those tests.

A test with an encrypted event was relying on the legacy mentions, so
the encrypted event was replaced with another one with an intentional
mention.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-09 15:08:38 +01:00
Kévin Commaille
a72c19a240 test(ui): Allow to set own user id of TestRoomDataProvider
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-09 15:08:38 +01:00
Kévin Commaille
cf4a1dee4b Upgrade Ruma after StringEnum changes
StringEnum now also implements Ord, PartialOrd, Eq and PartialEq so it
is not necessary to derive them. Also the ordering used is comparing the
string representation of the variants.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-09 15:08:38 +01:00
Kévin Commaille
487470be8f Upgrade Ruma after extended profile field stabilization
Extended profile fields were stabilized so the old endpoints are now
deprecated, and there are a few other changes.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-09 15:08:38 +01:00
Richard van der Hoff
b94823216d Merge pull request #5766 from matrix-org/rav/device_keys_self_signature
crypto: give `DeviceKeys` ability to check their own signature
2025-10-09 12:26:41 +01:00
Richard van der Hoff
232119cf57 crypto: avoid redundant conversion to DeviceData
There is (now) no need to turn the `sender_device_keys` into a `DeviceData`.
2025-10-09 11:32:09 +01:00
Richard van der Hoff
64818e2ef9 crypto: docs on Account::check_sender_device_keys (#5765)
I had to do some thinking about this, so wrote down my conclusions.
2025-10-09 11:31:30 +01:00
Richard van der Hoff
a2ded93234 crypto: give DeviceKeys ability to check their own signature
Adds `DeviceKeys::has_signed` and `DeviceKeys::check_self_signature`, and
removes `DeviceData::has_signed` and `DeviceData::verify_device_keys`.

I just found this easier to grok, and it means we can avoid needlessly turning
a `DeviceKeys` into a `DeviceData` sometimes.
2025-10-09 11:14:42 +01:00
Stefan Ceriu
fc892564d8 fix(spaces): handle empty string room names when computing the display names
Fixes #5762
2025-10-09 12:59:06 +03:00
Johannes Marbach
358803783f feat(oauth): add LoginProgress::SyncingSecrets
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-10-08 11:00:54 +02:00
Benjamin Bouvier
ef440eed2b chore(base): don't log the same missing room info log line on every single sync
This should only happen when a room has been forgotten and was a room
DMs before. Ideally, we'd clean up the room DM event data, but since
this is slightly more involved, we don't do that here just quite yet.
2025-10-07 21:03:09 +02:00
Johannes Marbach
79e1930b22 Make LoginProgres::EstablishingSecureChannel generic in order to reuse it for the other QR login flow
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-10-07 21:00:42 +02:00
Kévin Commaille
6191e2c24e fix(sdk): Make impl Stream return type not use any lifetime
With Rust 2024, by default `impl` return types use any generic that is
in scope, so in these cases the lifetime of `self`.

But since the return type is actually owned, the returned impl shouldn't
use any lifetime, which is what `use<>` does.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-07 15:22:52 +02:00
Kévin Commaille
ba2fe1d387 fix(crypto): Make impl Stream return type not use any lifetime
With Rust 2024, by default `impl` return types use any generic that is
in scope, so in these cases the lifetime of `self`.

But since the return type is actually owned, the returned impl shouldn't
use any lifetime, which is what `use<>` does.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-07 15:22:52 +02:00
Stefan Ceriu
87d9bd14e3 feat(spaces): reuse existing room display name computation logic for spaces 2025-10-07 13:05:59 +03:00
Benjamin Bouvier
44a4ca94be chore: fix new typos 2025-10-06 17:39:23 +02:00
Benjamin Bouvier
7fbc4144b1 feat(timeline): allow a poll edit to be an embedded event
This will properly show edited polls as the latest thread id, as a nice
benefit.
2025-10-06 14:05:34 +02:00
Benjamin Bouvier
a2a26ae45e refactor(timeline): pass directly the poll start and fallback text to PollState ctor 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
06301bc2f8 refactor(timeline): store fewer datum a in PollState
We don't really need the poll start event entirely, since we're only
interested in the start block and the fallback text. With this, it'll be
simpler to create embedded polls from poll edit events.
2025-10-06 14:05:34 +02:00
Benjamin Bouvier
85abe76121 feat(timeline): also support poll edits as embedded events 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
97ff61081a feat(timeline): support edits in embedded events 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
0017ccb0c1 feat(event cache): update a thread summary if an edit related to the latest thread reply 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
350fdd8ad4 feat(common): add support for extracting only an edited target event id from an edit event 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
f937bf60e2 refactor(event cache): make naming more consistent around latest thread event 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
da394f5015 refactor(event cache): update the thread summary in a separate function 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
158e3925b7 refactor(event cache): don't collect back-paginated events that are going to be filtered out immediately 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
4828f4c555 refactor(event cache): rename save_event to save_events as it's involving multiple events 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
92e7cb3af2 refactor(event cache): save the content of threaded events in the store 2025-10-06 14:05:34 +02:00
Benjamin Bouvier
a6a590aa1f test(timeline): add a test that an edit to a thread's latest event updates the thread summary 2025-10-06 14:05:34 +02:00
Kévin Commaille
d01a28c9b2 Upgrade Ruma
Brings a breaking change with event structs being non-exhaustive now,
so they need to be constructed with methods rather than with a struct
declaration.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-06 10:21:00 +02:00
Johannes Marbach
68075b65fb refactor(auth): make auxiliary functions reusable outside LoginWithQrCode
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-10-04 09:41:16 +02:00
Kévin Commaille
d4d40945e8 refactor(tests): Use EventFactory to build events
There is a breaking change in Ruma and those types are now
non-exhaustive so they can't be built with the struct declaration
anymore.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-03 17:01:58 +02:00
Stefan Ceriu
d85b45ed64 feat(spaces): sort space room list rooms as defined in the spec
The ordering criteria is defined at https://spec.matrix.org/latest/client-server-api/#ordering-of-children-within-a-space. The gist is that `order` comes first, then `timestamp` and finally the `room_id`

This is not available for top level spaces, but there is an MSC that addresses it at https://github.com/matrix-org/matrix-spec-proposals/pull/3230 and Ruma support has been added in https://github.com/ruma/ruma/pull/2231. The SDK side implementation for that will come in a later PR.
2025-10-03 15:22:52 +02:00
Stefan Ceriu
b43237536d chore(spaces): store the full children_state data when fetching /hierarchy 2025-10-03 15:22:52 +02:00
Kévin Commaille
fbafae42bb refactor(tests): Replace uses of EventBuilder::into_raw
We actually want other event formats in those cases, and in most cases
just using `.into()` is enough to generate the proper format.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-03 15:22:25 +02:00
Andy Balaam
32f3670aeb task(crypto): Warn API users to fetch device info before processing verification requests 2025-10-03 14:21:44 +01:00
Ivan Enderlin
8a23aae9dc perf(common): Compute the message in TracingTimer when required (#5662)
This patch moves the creation of the `message` in `TracingTimer` if and
only if the log is enabled. Computing it every time is useless, and can
even slow things down (because of the time calculation).
2025-10-03 15:19:47 +02:00
Ivan Enderlin
a7cb094aaf feat(sqlite): Add a write-only connection in SqliteStateStore.
This patch introduces a write-only connection in `SqliteStateStore`
_à la_ `SqliteEventCacheStore`. The idea is to get many read-only
connections, and a single write-only connections behind a lock, so that
there is a single writer at a time.

This patch renames the `acquire` method to `read`, and it introduces a
new `write` connection.
2025-10-03 15:00:37 +02:00
Ivan Enderlin
764a8a4c77 doc(sqlite): Fix // to ///.
This patch transforms an inline comment into a doc comment.
2025-10-03 15:00:37 +02:00
mgoldenberg
2e6790d0a5 IndexedDB: upgrade indexed_db_futures dependency (#5722)
**NOTE:** _this should not be merged until matrix-org/rust-indexed-db#1
is merged! The `[patch]` in this branch should point to the official
`matrix-org` fork of `rust-indexed_db`, but is currently pointed at my
personal fork._

## Background

This pull request makes updates
[`indexed_db_futures`](https://docs.rs/indexed_db_futures/latest/indexed_db_futures/index.html)
in the `matrix-sdk-indexeddb` crate. The reason we'd like to update this
dependency is because the version currently used does not fully support
the Chrome browser (see #5420).

The latest version of `indexed_db_futures` has significant changes. Many
of these changes can be integrated without issue. There is, however, a
single change which is incompatible with the `matrix-sdk-indexeddb`
crate. Namely, one cannot access the active transaction in the callback
to update the database (for details, see Alorel/rust-indexed-db#66).

### An Updated Proposal

Originally, new migrations were implemented in order to work around this
issue (see #5467). However, the proposal was ultimately rejected (see
@andybalaam's
[comment](https://github.com/matrix-org/matrix-rust-sdk/pull/5467#issuecomment-3149550617)).

For this reason, the dependency has instead been `[patch]`ed in the
top-level `Cargo.toml` with a modified version of `indexed_db_futures`
(see matrix-org/rust-indexed-db#1). Furthermore, these changes have been
proposed to the maintainer and are awaiting feedback (see
Alorel/rust-indexed-db#72).

### Why do we need the active transaction in our migrations?

The `crypto_store` module provides access to the active transaction to
its migrations (see
[here](ca89700dfe/crates/matrix-sdk-indexeddb/src/crypto_store/migrations/mod.rs (L211))).
Furthermore, there is a single migration (`v11_to_v12`) in the
`crypto_store` module which actually makes use of the active transaction
(see
[here](ca89700dfe/crates/matrix-sdk-indexeddb/src/crypto_store/migrations/v11_to_v12.rs (L23))).

For clarity, the reason `v11_to_v12` is problematic in the latest
versions of `indexed_db_futures` is because it is simply adding an index
to an object store which was created in a different migration and this
requires access to the active transaction. All the other migrations
create object stores and indices in the same migration, which does not
suffer from the same issue.

## Changes

- Move `indexed_db_futures` to the workspace `Cargo.toml` and add a
`[patch]` so that it points to a modified version.
- Add `GenericError` type and conversions in order to more easily map
`indexed_db_futures` errors into `matrix-sdk-*` errors.
- Update all IndexedDB interactions so that they use the upgraded
interface provided by `indexed_db_futures`
- Add functionality for running `wasm-pack` tests against Chrome


---
Closes #5420.

---

- [ ] Public API changes documented in changelogs (optional)


Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>

---------

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-03 14:10:10 +02:00
Stefan Ceriu
67d8db3d93 fix(spaces): filter out non-joined rooms from the space leaving process and handle 2025-10-03 13:43:14 +03:00