Commit Graph

13515 Commits

Author SHA1 Message Date
Kévin Commaille
08563d4096 refactor(sdk-test): Use enum to represent possible event formats of EventBuilder
And use the proper fields for these formats. We also add more conversion
implementations for the types associated with these formats.

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
Jorge Martín
2822815384 feat(ffi): Add NotificationSettings::get_raw_push_rules
This allows clients to get the raw push rules so they can be added to bug reports if needed
2025-10-03 15:16:07 +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
Ivan Enderlin
52518e0e2e fix(sdk): Use RoomPowerLevels::user_can_kick_user in filter_any_sync_state_event.
This patch replaces `user_can_kick` by `user_can_kick`: it performs an
extra check to make sure the acting user has at least the same power
level as the target user.
2025-10-03 12:37:37 +02:00
Kévin Commaille
b8b54246c4 Silence unused-imports lint
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-03 12:27:50 +03:00
Kévin Commaille
95e93ca00b fix(ui): Fix broken links
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-03 12:27:50 +03:00
Kévin Commaille
bb6ba08dfb fix: Remove newly detected unused imports
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-03 12:27:50 +03:00
Kévin Commaille
8c515b0c12 fix(docs): Replace doc_auto_cfg with doc_cfg feature
The former has been merge in the latter, and it errors when generating
the docs in a recent version of nightly, like the one used on docs.rs.

This also requires to bump the version of nightly used in CI, otherwise
it would break the docs generation.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-03 12:27:50 +03:00
Ivan Enderlin
81a69f82d2 feat(sdk): Accept invite for latest event if it targets the current user. 2025-10-03 11:26:45 +02:00
Ivan Enderlin
f4a6d12979 refactor(sdk): Split power_levels in latest_event.
This patch splits `power_levels: &Option<(&UserId, RoomPowerLevels)>`
into 2 variables: `own_user_id: Option<&UserId>` and `power_levels:
Option<&RoomPowerLevels>`. The idea is to be able to get the
`own_user_id` even if the power levels are `None`.
2025-10-03 11:26:45 +02:00
Ivan Enderlin
203a3783ae feat(sdk): Support m.room.membership with membership: "invite" as latest event. 2025-10-03 11:26:45 +02:00
Ivan Enderlin
8eb7264e5d test(sdk): Test that m.room.member for an invite can be a latest event candidate. 2025-10-03 11:26:45 +02:00
Kévin Commaille
a4bd36cbe8 fix(ci): Fix cargo-codspeed command
A new release occurred which has a breaking change in the syntax used to
select a benchmark.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-02 21:33:24 +02:00
Stefan Ceriu
8e8ad0167a change(spaces): return a reference to the rooms vector from the leave handle
well now
2025-10-02 12:41:42 +03:00
Stefan Ceriu
0f78959c9a change(spaces): compute LeaveSpaceRooms for the LeaveSpaceHandle asynchronously in its constructor 2025-10-02 12:41:42 +03:00
Stefan Ceriu
7a431a3afd change(spaces): have the leave space rooms interface take a filter
This helps make sure the rooms to be left were actually part of the space graph as they are stored inside the `LeaveRoomHandle` and filtered from there. On the FFI layer on the other hand, we still take plain strings as working around the limitations would've significantly complicated things.
2025-10-02 12:41:42 +03:00
Stefan Ceriu
a6d033ea4c chore(spaces): move joined_rooms and the SpaceGraph underneath the same Arc Mutex 2025-10-02 12:41:42 +03:00
Stefan Ceriu
ad41cbc368 chore(spaces): remove unused Unknown Space Error variant 2025-10-02 12:41:42 +03:00
Stefan Ceriu
cf0c3e7009 chore(spaces): move the LeaveSpaceRoom struct to the top of the file 2025-10-02 12:41:42 +03:00
Stefan Ceriu
3a60d34f3f feat(ffi): expose the space service leaving interfaces
fix newline ffi
2025-10-02 12:41:42 +03:00
Stefan Ceriu
9114c22b70 feat(spaces): add mechanism for _ordely_ leaving a space and its children
When leaving a space the user should be informed of which rooms are DMs (already part of the `SpaceRoom`)
and in which they might be the last admin, where leaving would prevent anybody else for taking control.
2025-10-02 12:41:42 +03:00
Stefan Ceriu
8655afd117 chore(spaces): store the built space graph in between the various updates so it can be used for leaving spaces 2025-10-02 12:41:42 +03:00
Stefan Ceriu
f5ec9b6427 feat(spaces): add graph method for retrieving a flat list of nodes belonging to a subtree ordered in bottom up dfs visiting order. 2025-10-02 12:41:42 +03:00
Ivan Enderlin
2eab7cf818 fix(ui): RoomListItem refreshes its cache_is_space. 2025-10-02 09:45:14 +02:00
Kévin Commaille
6072618e85 Add changelog for caption change
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-02 08:15:56 +02:00
Kévin Commaille
70b19cc907 refactor(sdk): Use TextMessageEventContent to send a caption
It doesn't make sense to send a formatted caption without a plain text
caption so using TextMessageEventContent forces the latter to be present.

This also allows to use the helpful constructors of
TextMessageEventContent.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-02 08:15:56 +02:00
Hubert Chathi
57d21ccdf6 Create a separate error variant to indicate a failure importing a secret. (#5647)
Part of the fix to
https://github.com/element-hq/element-x-android/issues/5099

Allows applications to distinguish between errors that occur when
unlocking Secret Storage, or errors that occur when importing a secret,
so that they can display appropriate feedback (or not) to the user.

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

<!-- Sign-off, if not part of the commits -->
<!-- See CONTRIBUTING.md if you don't know what this is -->
Signed-off-by:

---------

Signed-off-by: Hubert Chathi <hubertc@matrix.org>
2025-10-02 08:14:46 +02:00
Benjamin Bouvier
37ee5d5075 refactor(stores): get rid of the temporary compute_filter_strings now that Ruma has been updated
This was a local fix for a bug in Ruma, that has been fixed upstream since then, so we can get rid of the workaround now.
2025-10-01 16:50:23 +00:00
Benjamin Bouvier
681b22142f refactor(timeline): add more logs when we couldn't create an embedded event
This should help figuring out why some thread's latest replies are
marked as "unsupported events".
2025-10-01 10:54:00 +02:00
Benjamin Bouvier
248d77a4d9 refactor(ffi): add debug logging when a latest event is not a standalone content item 2025-10-01 10:54:00 +02:00
Benjamin Bouvier
f4451b5c82 refactor(timeline): TimelineAction::from_content always returns Something now 2025-10-01 10:54:00 +02:00
Mathieu Velten
59b7da247c Add some doc to add_event_handler for invites and stripped state (#5705)
Signed-off-by: Mathieu Velten <mathieu@velten.xyz>
Co-authored-by: Damir Jelić <poljar@termina.org.uk>
2025-09-30 14:25:17 +00:00
Benjamin Bouvier
be5bd449b5 test(timeline): ensure unthreaded receipts are loaded in the main timeline view mode 2025-09-30 15:09:57 +02:00
Benjamin Bouvier
2eb29518dc refactor(timeline): no need to look at the receipt timestamp
I was wrong in a previous commit: both receipts are on the same event
anyways, so we can safely override the keys in the read receipts map
(overriding would mean both receipts point to the same event, which is
fine, as we're displaying only one of those).
2025-09-30 15:09:57 +02:00
Benjamin Bouvier
16d0840115 refactor(timeline): move code around for loading initial main|unthreaded receipts 2025-09-30 15:09:57 +02:00
Benjamin Bouvier
d90576bf0d fix(timeline): when loading initial receipts for main|unthreaded, load both kinds
This is a fix, because some other code elsewhere will use both kinds of
receipts whenever they're received over sync. The code that's modified
in this patch is called for the initial load of receipts, that happens
whenever we see a new event. Since the two code paths were not doing the
same thing, this would affect the displayed receipts, depending on
whether we received them during sync, or after loading the timeline for
the first time.
2025-09-30 15:09:57 +02:00
Benjamin Bouvier
bbeb2d21b1 refactor(timeline): slightly rearrange code so as to remove a dubious comment 2025-09-30 14:29:27 +02:00
Benjamin Bouvier
187b646c07 refactor(event cache): have the room pagination handle waiting for the previous pagination token from sync
This case is very specific to the room pagination, and will not apply to
the thread pagination; by removing it from the generic pagination logic,
we'll be able to use the generic pagination logic for threads.
2025-09-30 14:29:27 +02:00
Benjamin Bouvier
8a47e3cd1c refactor(event cache): inline conclude_load_more_for_fully_loaded_chunk into its only caller
And that's one overlong function name less!
2025-09-30 14:29:27 +02:00
Benjamin Bouvier
973d71f54e docs(event cache): add comments to clarify when None can be returned from internal pagination methods 2025-09-30 14:29:27 +02:00
dependabot[bot]
943b048fa0 chore(deps): bump bnjbvr/cargo-machete
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from cb0995971182a3babbea3f086bf306d5509cac47 to 7c2dc36a6fe4a75848d9397e34c95474f38c82ef.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](cb09959711...7c2dc36a6f)

---
updated-dependencies:
- dependency-name: bnjbvr/cargo-machete
  dependency-version: 7c2dc36a6fe4a75848d9397e34c95474f38c82ef
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-30 09:36:57 +01:00
dependabot[bot]
2c70c31c56 chore(deps): bump crate-ci/typos from 1.36.2 to 1.36.3
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.36.2 to 1.36.3.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.36.2...v1.36.3)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-version: 1.36.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-30 07:36:48 +03:00
Ivan Enderlin
be7129bacc chore(ui): Remove an unnecessary Arc in SpaceRoomList.
`SharedObservable` is already shareable, no need for an `Arc` here.
2025-09-29 09:54:54 +03:00
Ivan Enderlin
2ec33183c4 doc(sqlite): Fix formatting and typo. 2025-09-26 16:07:20 +02:00
Doug
d6d720c015 ffi: Expose a room list filter for spaces. 2025-09-26 10:22:53 +01:00