Commit Graph

8076 Commits

Author SHA1 Message Date
Kévin Commaille
ef322cc39b base: Add room member ID to AmbiguityChange
Makes AmbiguityChange easier to use, especially outside of SyncResponse,
where we might not have the m.room.member event.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-01-30 16:33:33 +01:00
Benjamin Bouvier
f5f8f47667 integration test: fix racy behavior in the test_toggling_reaction
The room sync could be over, and then the timeline items would not contain the updated item yet, if the timeline didn't get a chance to finish its
internal update. Fix this by:

1. limiting the sync time to 10 seconds
2. giving up to one second for the timeline to update internally, by watching its stream of events (we're ignoring stream updates just after this loop)
2024-01-30 12:42:56 +01:00
Jorge Martin Espinosa
c418f0e6ba timeline: Add TimelineEventTypeFilter (#3025)
Adds a `TimelineEventTypeFilter` enum that either returns only events whose event_type is included in a set of allowed event types, or all events but those whose event types are in a list of excluded event types.

Also adds `TimelineEventTypeFilter` so the clients can use it to define those lists of event types, which are then converted to ruma `TimelineEventType` and used for filtering.

---

* matrix-sdk-ui: add `TimelineEventTypeFilter` to filter timeline events by either including only those of some event types or all but the ones that match those event types.

* ffi: add bindings to `TimelineEventTypeFilter` and `FilterTimelineEventType` so we can provide these event types from the FFI clients

* Fix format

* Fix tests

* Fix format again (using nightly toolchain)

* Remove `all_filter_...` functions as there is no right way to support it at the moment and they're just helpers

* Improve tests

* Make `TimelineEventFilterFn` public so it can be used in several layers.

* Make `TimelineEventTypeFilter` a struct in the FFI layer

* Add fns for creating a timeline with cache and event type filters

* Remove dead code

* Fix some review comments

* ffi: create new timeline initialization APIs, modify existing ones.
ui: make `Room::timeline()` return `None` if no timeline exists instead of lazily creating one.

More details:

- Added `init_timeline_with_builder` to `matrix_sdk_ui::room_list_service::Room` so a timeline can be initialized at will given a `TimelineBuilder`.
- Create `is_timeline_initialized()` fns in both the ui and ffi layers to check the status of the timeline.
- Make `matrix_sdk_ui::room_list_service::Room::timeline()` only return a timeline if it's already been initialized.
- Create FFI functions to expose these UI ones.

* Fix tests

* Fix some review comments

* Update bindings/matrix-sdk-ffi/src/room_list.rs

Signed-off-by: Benjamin Bouvier <public@benj.me>

---------

Signed-off-by: Benjamin Bouvier <public@benj.me>
Co-authored-by: Benjamin Bouvier <public@benj.me>
2024-01-30 11:00:43 +00:00
Benjamin Bouvier
cde7dd2ea8 integration test: make test_toggling_reaction fail fast (#3070)
It's started failing with timeouts in multiple PRs, so this PR should help spot where the issues specifically are, since codecov test failures are so hard to reproduce locally.
2024-01-30 09:52:53 +00:00
Kévin Commaille
6e3892528c intergation-testing: Fix syntax of docker-compose.yml
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-01-29 18:01:33 +01:00
Ivan Enderlin
fca455c0bf Merge pull request #3063 from zecakeh/compose-v2
integration-testing: Improve docker-compose.yml compatibility with Podman
2024-01-29 13:52:25 +01:00
Kévin Commaille
cd90265eab integration-testing: Update command to clean up docker compose data
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-01-29 11:50:33 +01:00
Kévin Commaille
25b2b191bb integration-testing: Make sliding-sync proxy depend on synapse in docker compose
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-01-29 11:48:58 +01:00
Kévin Commaille
3ade16a07d integration-testing: Add newline at end of docker-compose.yml
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-01-28 17:49:21 +01:00
Kévin Commaille
411dd29244 integration-testing: Use volumes in docker-compose.yml
Podman running unprivileged containers by default, using system folders
can result in permission issues inside the containers.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-01-28 12:20:43 +01:00
Kévin Commaille
1e74be2b2d integration-testing: Remove links in docker-compose.yml
It is not supported by podman and is not necessary by defaut

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-01-28 12:18:33 +01:00
Kévin Commaille
a77b67eecd integration-testing: Migrate to Compose V2
Compose V1 was deprecated in January 2023 and is not
supported anymore since July 2023

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-01-28 12:16:50 +01:00
Jonas Platte
18eefcffdb Move matrix-sdk-crypto enum definitions out of UDL 2024-01-27 00:31:42 +01:00
ganfra
25ecf089aa sliding_sync : fix room account data not being processed when there is no other changes in the room (#3032)
This fixes an issue with the sliding sync processing where room account data are not processed when the associated room has no other changes.

---

* sliding_sync : fix room account data not being processed when there is no other changes in the room

* sliding_sync : properly handle room_account_data from extension

* sliding_sync : add test for processing rooms_account_data

* sliding_sync : fix formatting

* Apply suggestions from code review

Co-authored-by: Ivan Enderlin <ivan@mnt.io>
Signed-off-by: ganfra <francois.ganard@gmail.com>

* sliding_sync : avoid cloning room account data events

Co-authored-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: ganfra <francois.ganard@gmail.com>

---------

Signed-off-by: ganfra <francois.ganard@gmail.com>
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
Co-authored-by: Benjamin Bouvier <public@benj.me>
2024-01-26 13:34:10 +01:00
Valere
8573417537 indexeddb(perf): don't deserialize data while in an indexeddb transaction (#2969)
A quick performance improvement to not do the deserialization/decryption inside the transaction.

---

* quick perf inbound_group_sessions_for_backup

* log on deserialize error

* Review: Unneeded use of :? for an object with Display trait

Co-authored-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Valere <bill.carson@valrsoft.com>

* Doc: fix capitalization

Co-authored-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Valere <bill.carson@valrsoft.com>

* Review: better naming

---------

Signed-off-by: Valere <bill.carson@valrsoft.com>
Co-authored-by: Benjamin Bouvier <public@benj.me>
2024-01-26 11:55:04 +01:00
Doug
f20c92a323 sdk: Support getting a room member's role. 2024-01-26 11:36:34 +01:00
Doug
be8be9ef04 sdk: Add uniffi scaffolding. 2024-01-26 11:36:34 +01:00
Jorge Martín
eccfab8b27 ffi: enable android_cleaner option in uniffi.toml
This allows us to use the native `SystemCleaner` in Android 13+ which is a bit safer regarding deadlocks than the JNA alternative we'd use otherwise.
Note this breaks compatibility with pure JVM environments, meaning the library can only be used in Android.
2024-01-26 11:20:55 +01:00
Benjamin Bouvier
25e4c8d722 read receipts: add lots of tracing logs for easier remote debugging 2024-01-26 10:45:02 +01:00
Benjamin Bouvier
a9d6ab7313 read receipts: take implicit receipts into account when computing unread counts 2024-01-26 10:45:02 +01:00
Ivan Enderlin
4d2c3e33fc Merge pull request #3042 from matrix-org/rav/room_settings
crypto: Implement `OlmMachine::{set_,}room_settings`
2024-01-25 16:28:34 +01:00
Jonas Platte
0be2747ccf Use new crates.io release of UniFFI 2024-01-25 16:25:55 +01:00
Richard van der Hoff
0b01a2a53a Merge branch 'main' into rav/room_settings
Signed-off-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2024-01-25 15:14:52 +00:00
Benjamin Bouvier
d85c7b213f sliding sync: take the sync lock when processing the response 2024-01-25 13:29:55 +01:00
Benjamin Bouvier
52b10e776c read receipts: use comparison instead of manually reporting read receipts have changed
Before, to avoid saving a room info if the read receipts `RoomInfo` field hadn't changed, we used explicit reporting to the caller that a field
changed value. This way was error-prone, and there's been bugs twice in this area: one fixed in a previous PR,
and there was another one in the existing implementation (when the pending list shrinked, it wouldn't tell the caller).

This commit changes the implementation so that it we snapshot the previous read receipts, and after processing unread counts, we compare the
new version with the snapshot, relying on `PartialEq` to do the leg work here. This is more future proof and less error prone.

Also `compute_unread_counts` isn't fallible, so doesn't need to return a Result.
2024-01-25 13:29:55 +01:00
Benjamin Bouvier
d88970155d read receipts: rename compute_notifications to compute_unread_counts 2024-01-25 13:29:55 +01:00
Benjamin Bouvier
1139538c76 comments: correct "inflight" to "in-flight" throughout the codebase 2024-01-25 11:58:13 +01:00
Benjamin Bouvier
a1a93afbe2 matrix-sdk: add doc comment to Client::handle_sync_response 2024-01-25 11:58:13 +01:00
Benjamin Bouvier
7a107d8fa2 timeline: inline handle_room_encrypted into its one caller TimelineEventHandler::add
It's a one-liner, so not much worth it as a separate function.
2024-01-25 11:58:13 +01:00
Benjamin Bouvier
5117325ef4 comment: make it clear when some account data comes from storage 2024-01-25 11:58:13 +01:00
Benjamin Bouvier
1085b85dfc timeline: replace floating timeline_item function with a ctor on TimelineItem
And add comments here and there.
2024-01-25 11:58:13 +01:00
Benjamin Bouvier
7a7e624e7b timeline: rename and invert meaning of event_should_update_fully_read_marker
This is renamed to `has_up_to_date_read_marker_item`, and inverted in meaning, compared to its previous meaning.
It's simpler to think of it as the presence of the read marker item: if it's not there, then that's the only case where we'd need to worry about adding one.
2024-01-25 11:58:13 +01:00
Benjamin Bouvier
384d8b0e19 timeline: add comments around read marker handling 2024-01-25 11:58:13 +01:00
Benjamin Bouvier
68c9e5e98d timeline: inline find_read_marker that's used only once 2024-01-25 11:58:13 +01:00
Richard van der Hoff
ff89315b6e crypto: add test for 4S keys with no mac or iv (#3048)
A regression test for https://github.com/matrix-org/matrix-rust-sdk/issues/2932

Also a changelog update.
2024-01-23 11:15:49 +00:00
Ivan Enderlin
eec52d7977 chore: Update Ruma to 684ffc
chore: Update Ruma to 684ffc
2024-01-22 15:13:01 +01:00
Ivan Enderlin
8515def61b fix(crypto): It's OK to have iv and mac missing.
This patch updates `SecretStorageKey::check_zero_message` to assume
that a missing `iv` and/or `mac` is valid, instead of an error, as the
spec suggests.
2024-01-22 15:00:23 +01:00
Richard van der Hoff
75ea0ad283 Rename session_rotation_period_msgs 2024-01-22 13:36:09 +00:00
Richard van der Hoff
ac24f62d8c Address review comments 2024-01-22 12:49:54 +00:00
Benjamin Bouvier
76cd7ab649 test: reenable the unread count test in code coverage (#3044)
The real reason why the test wasn't passing was the same root cause as #3031. The client's room member information was missing, meaning we couldn't compute a push context, so we couldn't compute notifications/mentions either. The fix is in the testing code itself, the sliding sync should request the `$ME` room member state event to work correctly and non-racily.
2024-01-22 12:49:28 +00:00
Ivan Enderlin
eab35c1289 chore: Update Ruma to 684ffc.
This patch updates Ruma to the latest commit on its `main` branch.

This is useful for https://github.com/matrix-org/matrix-rust-sdk/issues/2932.
2024-01-22 13:42:00 +01:00
Benjamin Bouvier
1d6c01fb34 Bump matrix-sdk to 0.7.1 2024-01-22 11:56:58 +01:00
Benjamin Bouvier
b680c50035 labs: introduce rrrrepl, a client specialized for showing and sending read receipts
This was quite handy during development of the client-side computation of read-receipts, to analyze some bugs.

It might be not useful to have it checked in for long, but I would love to make sure it keeps on compiling
until we have a more stable handling of read receipts in general.
2024-01-22 11:01:26 +01:00
Ivan Enderlin
20b8c41727 Merge pull request #3031 from matrix-org/sliding-sync-add-$me-to-required-state-for-all-rooms
room list service: add `$ME` as a required state for the `all_rooms` sliding sync list
2024-01-22 10:50:47 +01:00
Ivan Enderlin
e9d2b1f27a feat: RingBuffer takes a NonZeroUsize
feat: `RingBuffer` takes a `NonZeroUsize`
2024-01-22 10:47:46 +01:00
Ivan Enderlin
f90d1678e2 Merge pull request #3038 from matrix-org/cleanup-registrations-again
oidc: cleanup `read_registration_data()` again
2024-01-22 10:46:24 +01:00
Ivan Enderlin
92b7598e4b Merge pull request #3041 from matrix-org/rav/stfu_dead_code
crypto: Silence compiler warning
2024-01-22 10:35:56 +01:00
Ivan Enderlin
10779481b7 feat: RingBuffer takes a NonZeroUsize.
The default implementation of `RingBuffer` was setting a capacity of 0.
This was incorrect as it wasn't possible to insert any items. This patch
updates it to take a `NonZeroUsize` so that it's impossible to set a
negative or zero capacity.
2024-01-22 10:34:49 +01:00
Richard van der Hoff
2314a74cdb crypto: Implement OlmMachine::{get,set}_room_settings
We need to make sure we guard against servers downgrading the encryption
settings, or breaking them with unsupported algorithms. It's not *entirely*
clear what the expectation is here, but legacy crypto in matrix-js-sdk blocks
any changes to the settings at all, so we'll follow suit for now.
2024-01-19 19:15:44 +00:00
Richard van der Hoff
5e0e752fcd memorystore: implement room settings saving 2024-01-19 19:15:44 +00:00