Commit Graph

8046 Commits

Author SHA1 Message Date
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
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
6d5f617355 crypto: Silence compiler warning 2024-01-19 17:36:50 +00:00
dependabot[bot]
9f0a1e0ce7 build(deps): bump h2 from 0.3.22 to 0.3.24
---
updated-dependencies:
- dependency-name: h2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-19 17:54:43 +01:00
Benjamin Bouvier
d6484a012c oidc: cleanup read_registration_data() again 2024-01-19 17:03:00 +01:00
Benjamin Bouvier
f7cb253b1c test: add test that after a first time sync with the room list service, we're able to compute notifications
trying to simplify test
2024-01-19 16:44:32 +01:00
Doug
2dbd4a28a1 oidc: Remove public registration errors that are only used internally. 2024-01-19 13:57:43 +01:00
Doug
5c3edfcf6a authentication: Merge the UI crate's authentication module into the SDK. 2024-01-19 13:57:43 +01:00
Benjamin Bouvier
20b97fc716 room list service: add $ME as a required state for the all_rooms sliding sync list
Without this, we wouldn't ever have the member information for the logged-in user, the first time they log in, if they don't happen to be the
last user sending a message in a room (a case covered by `$LAZY`).
2024-01-19 13:02:23 +01:00
Kévin Commaille
b3f4e658c5 base-client: Support notifications in invited rooms (#2907)
Necessary for the `.m.rule.invite_for_me` rule that should only happen in invited rooms.

Requires to create a `Notification` type that accepts stripped state events. It is simpler than Ruma's type because it lacks fields with data that is made up or redundant.

Tested locally with Fractal.

Fixes #1912.

---

* Upgrade Ruma

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* base-client: Support notifications in invited rooms

Necessary for the .m.rule.invite_for_me rule that should
only happen in invited rooms.
Requires to create a Notification type that accepts stripped state
events.
It also removes fields with data that is made up or redundant.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* matrix-sdk-test: Add macros to construct raw sync or stripped state events

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* client: Add tests for register_notification_handler

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Upgrade Ruma

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Fix base changelog

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Fix methods on Room

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Fix FFI

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Fix FFI RoomMember

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Simplify and_then chain

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-01-19 10:30:35 +00:00
Benjamin Bouvier
a3fe9c357b read receipts: address PR comments (renamings + comments) 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
2fcd28ab0c read receipts: include implementation details in the module's doc comment 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
5e029aa7a0 read receipts: slightly simplify the new active receipt case 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
95edb9f864 read receipts: rename account_event to process_event
and address some other review comments.
2024-01-18 16:48:47 +01:00
Benjamin Bouvier
7116ed4848 ring buffer: show the behavior of a ring buffer with 0 capacity with a test 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
c00f9e9312 read receipts: use a ring buffer to limit the number of pending receipts 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
26896599de ring buffer: Add retain() to the ring buffer implementation 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
3b5238135d read receipts: tracing improvements to help debugging 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
0e5cc44ffa read receipts: use a lax comparison when selecting better receipts
Before, restoring a timeline from the cache, for which we had a receipt for the last element, would not mark that receipt as "interesting", thus
considering that all the events are new. This is incorrect, and another way to fix that would be to set `best_receipt` to the initial read receipt;
but having the information that we had a change is more useful in general, so the comparison is changed from strict to lax here.
2024-01-18 16:48:47 +01:00
Benjamin Bouvier
ca47e6d5f9 read receipts: dismiss old events when they contain common events with the new set
When restoring a timeline from the disk cache, or when we get a timeline from a limited sync, we can have events in common to the two sets, messing
up with the count. In that case, forget about previous events, since we don't try to stitch timelines yet.
2024-01-18 16:48:47 +01:00
Benjamin Bouvier
75f1aaced6 ui timeline: add a note about a proxy workaround for duplicate timeline items 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
de316acc11 read receipts: don't get confused when receiving multiple times the same event
This is a workaround because the proxy may send the same event multiple times in a sync timeline. When that happens and we had the read receipt
on the duplicated event, it may cause some events to be counted twice, resulting in invalid counts. This patch fixes it by resetting the count
*every* time we see the matching event.
2024-01-18 16:48:47 +01:00
Benjamin Bouvier
706e477e02 read receipts(chore): clippy/rustfmt/typos 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
6716ad6374 read receipts: have compute_notifications return true when stashing pending receipts 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
92df885474 read receipts: introduce ReceiptSelector helper and add many unit tests
The `ReceiptSelector` splits the tasks of computing a better new receipt into small parts, making it trivial to test in isolation.
2024-01-18 16:48:47 +01:00
Benjamin Bouvier
ddb44d35cd read receipts: extract create_sync_index out of compute_notifications and unit-test it 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
8de6345d0f test: add test for multiple receipts coming in the same sync 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
e6d33eaf90 test: use existing make_receipt_event_content test helper 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
fa74602c65 test: introduce test helper sync_timeline_message 2024-01-18 16:48:47 +01:00
Benjamin Bouvier
5cbc34811f read receipts: use sync order
No caching. Step 1 make it correct, etc.
2024-01-18 16:48:47 +01:00
Benjamin Bouvier
2d60611a44 read receipts: don't repeat iterating over older events if the server sent us the same receipt twice 2024-01-18 16:48:47 +01:00