Commit Graph

13223 Commits

Author SHA1 Message Date
Ivan Enderlin e4d0f2291f feat(sdk): Add SlidingSyncListRequestGenerator::is_selective.
This patch adds a small helper:
`SlidingSyncListRequestGenerator::is_selective`.
2024-08-21 13:11:09 +02:00
Ivan Enderlin 31f84d7534 feat(sdk): Implement SlidingSyncListLoadingState::is_fully_loaded.
This patch implements and tests
`SlidingSyncListLoadingState::is_fully_loaded` for more convenience.
2024-08-21 13:11:09 +02:00
Ivan Enderlin 4c5b537825 test(sdk): Rename tests.
This patch renames tests.
2024-08-21 13:11:09 +02:00
Richard van der Hoff d9e6bfa678 Add a tip about using RustRover 2024-08-21 09:41:54 +01:00
Stefan Ceriu f0d98602a9 timeline: use the EncryptionInfo provided by the replacement event when processing edits
- this prevents issues where spoofing the sender field is enough to spoof and edit and display wrong decorations in the app
- fixes matrix-org/internal-config/issues/1549
2024-08-21 10:31:33 +02:00
Richard van der Hoff a27ebaabae ffi: add ClientBuilder::room_key_recipient_strategy
... and pass it through to the underlying ClientBuilder.
2024-08-20 18:22:56 +01:00
Richard van der Hoff 9b78903705 crypto: add ClientBuilder::with_room_key_recipient_strategy
... and pass it into the constructed BaseClient.
2024-08-20 18:22:56 +01:00
Richard van der Hoff 0151f32425 crypto: add BaseClient::room_key_recipient_strategy field
... and use it when sharing a room key.
2024-08-20 18:22:56 +01:00
Andy Balaam ca09917d84 crypto: Update the comment about source of truth for in sqlite 2024-08-20 15:36:34 +01:00
Andy Balaam 78924ed877 crypto: In sqlite, use the SQL column value for backed_up everywhere
Most times we pulled an InboundGroupSession from the sqlite DB, we were
overriding whatever value for `backed_up` was stored inside the pickled
value, and using the value stored in the SQL column.

But when we pulled a single InboundGroupSession from the DB by ID, we
did not override it.

I am fairly sure this was an accidental oversight, so this change
corrects it, and unifies the code with other places we create these
objects.
2024-08-20 15:36:34 +01:00
Andy Balaam 668a267c9b crypto: Merge deserialize_pickled_inbound_group_session into unpickle_inbound_group_session 2024-08-20 13:16:17 +01:00
Andy Balaam fed08fad76 crypto: Utility deserialize_and_unpickle_inbound_group_session for sqlite store 2024-08-20 13:16:17 +01:00
Richard van der Hoff 651b61414e crypto: add a note about libolm only being used in tests
It seems that the fact that matrix-rust-sdk contains `olm-rs` in its
`Cargo.lock` sparked panic, so let's attempt to fend off future concerns by
adding a comment.
2024-08-20 12:16:33 +01:00
Benjamin Bouvier bbefad34bc test: reuse the internal EventFactory of the TestTimeline in more places
Also rename a few `factory` to `f`, for consistency with the rest of the
testing code.
2024-08-20 12:11:11 +02:00
Benjamin Bouvier b00f58a28d test: get rid of TestTimeline::handle_live_message_event in favor of TestTimeline::handle_live_event
By using the `EventFactory` a bit more.

Part of #3716.
2024-08-20 12:11:11 +02:00
Kévin Commaille 3b3474688b sdk: Upgrade mas-oidc-client
Gets rid of the old version of the http crate.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-08-19 23:14:27 +02:00
Ivan Enderlin ed19bf7bc5 fix(ffi): New fields formatter to remove duplicated span fields.
This patch fixes a bug in the tracing system. It introduces one
fields formatter _per layer_ to force the fields to be recorded in
different span extensions, and thus to remove the duplicated fields in
`FormattedFields`.

The patch contains links to the bug report in `tokio-rs/tracing`. This
patch is a workaround.
2024-08-19 14:44:04 +02:00
Ivan Enderlin eeb325abb7 chore(ffi): Format code. 2024-08-19 14:44:04 +02:00
Richard van der Hoff 9d7dd1a6d6 crypto: update changelog 2024-08-19 13:13:58 +01:00
Richard van der Hoff 820f4ee711 crypto: tests for errors on verification violation 2024-08-19 13:13:58 +01:00
Richard van der Hoff 271ba98ba9 crypto: test: factor out EncryptionSettings helper 2024-08-19 13:13:58 +01:00
Richard van der Hoff 7575c256d4 crypto: test: move unsigned_of_verified_setup helper function
I want to use this in more tests, so move it out of the middle of the test
module.
2024-08-19 13:13:58 +01:00
Richard van der Hoff cd0d79dd88 crypto: Key sharing option to error for verification violation 2024-08-19 13:13:58 +01:00
Richard van der Hoff d35e3405ab crypto: Add UserIdentityData::was_previously_verified
Since `was_preivously_verified` is implemented for both variants, we can add a
helper here.
2024-08-19 13:13:58 +01:00
Ivan Enderlin 711a753533 doc(sdk): Update CHANGELOG.md. 2024-08-19 07:22:29 +02:00
Ivan Enderlin 4e291205d5 feat(sdk): Remove NotificationSettings::subscribe_to_changes.
This patch removes `NotificationSettings::subscribe_to_changes` because
it's not used anywhere in our code except in tests. It is indeed part of
the public API but I'm not aware of anyone using it for the moment. It
only adds complexity in the code.
2024-08-19 07:22:29 +02:00
Richard van der Hoff b497577717 crypto: use UserIdentities utility functions
... instead of lots of `match` and `own()` and `other()`.
2024-08-16 16:58:27 +01:00
Richard van der Hoff 9077310eb2 crypto: Add utility wrappers to UserIdentities
We have a bunch of methods which are the same in both `OtherUserIdentity` and
`OwnUserIdentity`, so add some convenience methods to access them.
2024-08-16 16:58:27 +01:00
Richard van der Hoff b4d265e997 crypto: update changelog 2024-08-16 15:07:36 +01:00
Richard van der Hoff dd810f4803 crypto: Track if our own identity was previously verified
... and expose new methods to access it.
2024-08-16 15:07:36 +01:00
Richard van der Hoff a6b78d8d53 crypto: replace OwnUserIdentityData::verified with enum
I want to make this a tri-state, so let's start by making it an enum.
2024-08-16 15:07:36 +01:00
Richard van der Hoff 96c4e4c49e crypto: update OtherUserIdentityData::is_device_signed to return bool
Once again: since all the callers end up calling `.is_ok()` on the result, and
the name implies it should return a bool, let's just return a bool.
2024-08-16 12:34:10 +01:00
Richard van der Hoff 5f9a4fc6d1 crypto: update OwnUserIdentityData::is_device_signed to return bool
As before: since all the callers end up calling `.is_ok()` on the result, and
the name implies it should return a bool, let's just return a bool.
2024-08-16 12:34:10 +01:00
Richard van der Hoff 31b25b8754 crypto: update OwnUserIdentityData::is_identity_signed to return bool
Since all the callers end up calling `.is_ok()` on the result, and the name
implies it should return a bool, let's just return a bool.
2024-08-16 12:34:10 +01:00
Ivan Enderlin fa6066b810 test(sdk): Test Room::cached_user_defined_notification_mode.
This patch adds a test for `Room::cached_user_defined_notification_mode`.
2024-08-15 14:51:16 +03:00
Ivan Enderlin 102da7cb9a feat(ffi): Add RoomInfo::cached_user_defined_notification_mode.
This patch replaces `RoomInfo::user_defined_notification_mode` by
its cached variant: `cached_user_defined_notification_mode`, and
call `Room::cached_user_defined_notification_mode` which will boost
performance when computing a new `RoomInfo`.
2024-08-15 14:51:16 +03:00
Ivan Enderlin 1c39086b5a feat(sdk): Cache the user-defined notification mode on each sync.
This patch caches the user-defined notification mode on each sync for
the sake of performance.
2024-08-15 14:51:16 +03:00
Ivan Enderlin 651e8fcd48 test(base): Split test_room_info_deserialization_without_optional_items.
This patch splits/copies the
`test_room_info_deserialization_without_optional_items` test into the
same test + `test_room_info_deserialization`.

It appears that the _without optional items_ part has been forgotten.
In the past, the test has been updated to test optional items. The
initial idea (based on my understanding of the comments) is to test
potentially old `RoomInfo` can still be deserialized today. So this test
must never be changed, except if a non-optional field is added.

For this reason, this patch removes from this test the assertions about
optional fields. A new test, named `test_room_info_deserialization` is
created, and tests all the fields, including the optional ones.

One important thing:
`test_room_info_deserialization_without_optional_items` now runs
even if the `experimental-sliding-sync` feature is absent. It was
required only because of `latest_event`, but that's an optional
field! However, the `test_room_info_deserialization` requires the
`experimental-sliding-sync` feature, as it tests `latest_event` but
also `recency_stamp`.

Finally, `test_room_info_deserialization` tests
`cached_user_defined_notification_mode`.
2024-08-15 14:51:16 +03:00
Ivan Enderlin ad947132ed feat(sdk): Room::user_defined_notification_mode caches its result.
This patch updates `matrix_sdk::Room::user_defined_notification_mode`
to cache its result if some mode has been found. The cached result can
be retrieve with
`matrix_sdk_base::Room::cached_user_defined_notification_mode`.
2024-08-15 14:51:16 +03:00
Ivan Enderlin 2a3525f7be chore(sdk): Add missing copyright. 2024-08-15 14:51:16 +03:00
Ivan Enderlin 7e2c773d21 chore(base): Move RoomNotificationMode into matrix-sdk-base.
This patch moves the `RoomNotificationMode` type from `matrix-sdk`
to `matrix-sdk-base` because it's going to be shared across multiple
crates.
2024-08-15 14:51:16 +03:00
Jorge Martín 6becbf61c9 fixup! Fixes after rebase 2024-08-14 17:38:24 +02:00
Jorge Martín 1155f75612 fixup! fix review comments 2024-08-14 17:38:24 +02:00
Jorge Martín 5cd29830a3 fixup! Fix clippy after merge 2024-08-14 17:38:24 +02:00
Jorge Martín 34370b1525 fixup! Fix test 2024-08-14 17:38:24 +02:00
Jorge Martín 1132074ae0 sdk-base: Make sure we only send a notable membership update when membership does change 2024-08-14 17:38:24 +02:00
Jorge Martín e5af5a32fa sdk-base: Add RoomInfoNotableUpdateReasons::MEMBERSHIP
This fixes joined rooms not being bumped to the top of the timeline and left rooms not disappearing from the room list.
2024-08-14 17:38:24 +02:00
Richard van der Hoff 1e8dd5dd41 crypto: Update changelog 2024-08-14 14:57:42 +01:00
Richard van der Hoff 5431c0fdd6 crypto: test: add tests for error_on_verified_user_problem 2024-08-14 14:57:42 +01:00
Richard van der Hoff a240b87ba6 crypto: test: factor out redundant variable
This thing was confusing. What is "legacy" about it?
2024-08-14 14:57:42 +01:00