Commit Graph

628 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
Benjamin Bouvier
e158e8abc0 refactor(timeline): in thread permalinks, avoid back-paginating if the root event is part of the /context response
For thread permalinks, we start with a /context query that will load the
focused event, and maybe a few other in-thread events. In fact, it can
also include the thread root event, which was excluded before. Instead,
we would get a previous-token for back-paginations, which would be used
in /relations. When the request to /relations returns an empty previous
token, that means we've reached the start of the thread, and in this
case we would manually load the root with /event.

We can do better, if the root event is part of the initial /context
response: skip the back-paginations altogether, and make sure to include
the root event in `init_focus()`.
2025-09-25 10:21:19 +02:00
Alexis Loiseau
0a0e31af83 feat(ui): add custom events to timeline when explicitly filtered
This allows custom message-like events (created by the `EventContent` macro from ruma) to be added to the timeline if they are explicitly allowed when building the timeline with a custom `event_filter`.

The custom event content is not available directly to the consumer, but it can still fetch it from the matrix-sdk client with its `event_id`, or display a "this type of event is not supported". 

Signed-off-by: Itess <me@aloiseau.com>

Fixes #5598.
2025-09-24 15:50:50 +00:00
Ivan Enderlin
ec5c31a19d chore(bench): Add the room_list benchmark.
This patch adds the `room_list` benchmark. The goal is to measure
the time it takes to create a room list, to sort it, to filter and to
“display” it.
2025-09-18 15:38:16 +02:00
Valere Fedronic
681863423c feat(rtc): Remove deprecated CallNotify in favour of RtcNotification
`CallNotify` event has been deprecated in favour of `RtcNotification` event https://github.com/ruma/ruma/pull/2199
2025-09-16 16:06:39 +02:00
Jorge Martín
163ed929fe refactor: Add docs to test helper 2025-09-12 08:21:14 +02:00
Jorge Martín
89fd0b5e53 feat(sdk): Allow adding and retrieving recent emojis
Include some tests.
2025-09-12 08:21:14 +02:00
Valere
e83af1aae2 tests: subscribe_to_call_decline_events 2025-09-06 11:15:49 +02:00
Damir Jelić
9ffe5aa6ca chore: Add a description to the test utils crate 2025-09-04 16:42:00 +02:00
Damir Jelić
f8b343bece chore: Include the test-utils crate in the release
Turns out, we do actually need to release it :(
2025-09-04 16:36:05 +02:00
Damir Jelić
94f8f8c44c Revert "chore: Disable releases for the matrix-sdk-test-utils crate"
This reverts commit f9bf492fdb.
2025-09-04 16:36:05 +02:00
Damir Jelić
4c1f80faf7 chore: Release matrix-sdk version 0.14.0 2025-09-04 16:05:48 +02:00
Damir Jelić
f9bf492fdb chore: Disable releases for the matrix-sdk-test-utils crate
The crate is only used as a dev dependency, as such we don't need to
release it.
2025-09-04 16:05:48 +02:00
Shrey Patel
412d4b80ee refactor(search): Move event processing out. 2025-09-03 15:05:23 +02:00
Damir Jelić
1e30916754 chore: Bump most of our deps 2025-09-01 16:33:10 +02:00
Stefan Ceriu
759eeeb27f feat(test): add event factory methods for creating space rooms and populating parent-children relationships. 2025-08-28 10:55:00 +03:00
Stefan Ceriu
763314645b feat(sdk): add a Client::joined_space_rooms method that allows retrieving the list of joined spaces. 2025-08-28 09:28:04 +02:00
Skye Elliot
baa75368d6 ci: Add feature matrix for integration testing
This will resolve a number of transitive dependency issues when testing
crates that do not enable the `experimental-encrypted-state-events` feature
flag by default.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-27 14:55:45 +02:00
Skye Elliot
8e5075569e feat: Add top-level support for decrypting state events (#5552)
Implements support for decryption of state events

- [ ] Introduce a case for `AnySyncStateEvent::RoomEncrypted` to the
`state_events` sync response processor.
- [ ] Introduce modified `Room::decrypt_event` and
`::try_decrypt_room_event`.
- [ ] Introduce testing macro
`assert_let_decrypted_state_event_content`.
- [ ] Add casts and explicit type hints where necessary.

---------

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-27 10:53:55 +01:00
Benjamin Bouvier
25a81876a0 tests: allow conversion from EventBuilder into Raw<AnyGlobalAccountDataEvent>
This avoids a few explicit `.into_raw()` calls here and there.
2025-08-21 15:21:14 +02:00
Benjamin Bouvier
e388fe6522 tests: streamline the SyncResponseBuilder global account methods
Only keep two: the one that uses the output of the event factory, and
one using custom JSON data.
2025-08-21 15:21:14 +02:00
Benjamin Bouvier
ef20342ddf tests: use the new global account data methods a bit more 2025-08-21 15:21:14 +02:00
Benjamin Bouvier
e6b1ffba99 tests: add support for the global account PushRules event in the event factory 2025-08-21 15:21:14 +02:00
Benjamin Bouvier
9a3ceb8be6 tests: add support for the global account IgnoredUserList event in the event factory 2025-08-21 15:21:14 +02:00
Benjamin Bouvier
faee647c3a tests: get rid of GlobalAccountDataTestEvent::Direct 2025-08-21 15:21:14 +02:00
Benjamin Bouvier
1866143456 tests: add support for the global account Direct event in the event factory 2025-08-21 15:21:14 +02:00
Skye Elliot
7adaf7be73 feat(sdk): Rename state encryption methods for improved clarity
Changes `Room::enable_encryption_with_state` to
`Room::enable_encryption_with_encrypted_state_events`, and updates the
respective unit test and testing utilities.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-20 12:28:03 +02:00
Skye Elliot
b73163aa45 feat(sdk): Add Room::enable_encryption_with_state
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-20 12:28:03 +02:00
dragonfly1033
13c30f6691 feat(sdk): Add creation of indexes and indexing of messages (#5505)
Integrate matrix-sdk-search into matrix-sdk.
When a room is joined, a corresponding index is created.
When a message is received via sync or via a back-pagination, it is
added to the corresponding room's index.

Signed-off-by: Shrey Patel shreyp@element.io
2025-08-18 14:52:09 +02:00
Kévin Commaille
a3a239f999 Upgrade Ruma: revert StrippedState
Handle the previous breaking change that was reverted: `StrippedState`
was removed and `AnyStrippedStateEvent` is used again.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-14 08:57:52 +02:00
multisme
a66b2c5123 feat(test): add a test utils crate to make log initialization possible everywhere
This PR allows `init_tracing_for_test` to be called by any other crate in the sdk

Signed-off-by: multi [multiestunhappydev@gmail.com](mailto:multiestunhappydev@gmail.com)
2025-08-14 05:24:03 +00:00
Kévin Commaille
7724271508 doc(test): Fix method auto-link
Rustdoc doesn't support passing parameters for auto-links.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-13 12:31:22 +01:00
Johannes Marbach
0a796cb468 feat(timeline): communicate media upload progress through EventSendState::NotSentYet
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-08-12 12:57:18 +02:00
Damir Jelić
b29886c0df test(crypto): Add a test that we refuse bundles if the sender isn't trusted enough 2025-08-08 15:56:13 +02:00
dragonfly1033
992774b8b5 Add the matrix-sdk-search crate
A new crate with a basic API for a creating, populating and searching a
room message index.

Signed-off-by: Shrey Patel shreyp@element.io
2025-08-07 16:01:41 +02:00
Jonas Platte
42d2b93489 refactor: Introduce TestResult and use it in a couple random places 2025-08-06 22:21:39 +00:00
Benjamin Bouvier
b585963abb test(notification client): check msc4306 behavior in the notification client too 2025-08-06 15:28:43 +02:00
Kévin Commaille
056e90db25 feat(sdk): Use state_after in sync v2 (#5488)
It is supposed to be an improvement over `state`, since it allows the
server to send updates to the state that might not be reflected in the
timeline.

This is also the same behavior as in Simplified Sliding Sync.

This is MSC4222 that was accepted and is about to get merged in the
spec.

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-06 13:42:49 +01:00
Kévin Commaille
787861eb35 fix: Upgrade Ruma
This brings 2 important bug fixes:

- Make deprecated fields of `m.room.encrypted` optional: it seems that there are events without these fields in the wild.
- Fix deserialization of `RedactedRoomJoinRulesEventContent`. This was found by a bug report in Fractal that caused the same error as #3557 when restoring the client. So maybe we could consider that this bug is fixed? It is still possible that there is another deserialization error. 

There is also a breaking change in the format of the `state` field in response to `GET /v3/sync`.
2025-08-05 16:04:34 +02:00
Hubert Chathi
a4da6ba7c8 Exclude insecure devices on Olm encryption (#5457)
Fixes the encrypting part of
https://github.com/matrix-org/matrix-rust-sdk/issues/4147

Probably easiest to review commit-by-commit

<!-- description of the changes in this PR -->

- [x] 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:
2025-08-04 08:50:32 +01:00
Kévin Commaille
b02e1da471 Upgrade Ruma
This brings in a new breaking change from Ruma, because not all events
are stripped in a room's stripped state. For simplicity, this still
considers the events as stripped during deserialization for now, since
this format is compatible with the other possible formats.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-01 14:07:28 +02:00
Damir Jelić
88360040fb test(timeline): Add some integration tests for the redecryption logic
These tests now fully mock all the end-to-end encryption server
endpoints to test the redecryption and UTD item replacement logic of the
timeline without any manual room key insertions.

We test that the item replacement correctly handles supported event
types as well as unsupported ones.
2025-07-30 12:46:04 +02:00
Kévin Commaille
0a7ac18d9f refactor: Add IsPrefix = False bound on StaticEventContent bounds
Since those APIs only support a full event type, not an event type prefix.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-25 17:36:19 +02:00
Kévin Commaille
0e622cc5a1 Upgrade Ruma (phase 3)
This upgrade introduces support for room version 12[1].

[1]: https://matrix.org/blog/2025/07/security-predisclosure/)

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-23 14:32:05 +00:00
Kévin Commaille
4931c0749e Upgrade Ruma again
This patch updates our `Raw` API usage since the newly added `JsonCastable` that disallows Raw casts that are known to fail deserialization. 

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-22 12:59:26 +00:00
Kévin Commaille
37626b5ad9 Bump Ruma
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-22 14:00:53 +02:00
Damir Jelić
b3c1ca1577 Use the invite details when deciding if we should accept a bundle 2025-07-17 16:39:17 +02:00
Jonas Platte
7d9d5bf3b4 refactor: Use if-let chain 2025-07-15 08:41:44 +02:00
Jonas Platte
ea076b3d76 chore: Upgrade testing crates to Rust Edition 2024 2025-07-15 08:41:44 +02:00
Damir Jelić
18b169ca7e chore: Release matrix-sdk version 0.13.0 2025-07-10 15:15:04 +02:00