Commit Graph

13223 Commits

Author SHA1 Message Date
manuroe 3d9d3b7ca6 Merge pull request #2977 from matrix-org/valere/long_mark_as_sent
Remove an expensive database call only used for tracing prupose
2024-01-02 13:35:36 +01:00
Valere 541d9184c6 remove expensive db call for tracing 2023-12-22 16:19:25 +01:00
Benjamin Bouvier 45bdbf5067 Add test to make sure notification count is taken into account when processing sliding sync 2023-12-22 14:45:54 +01:00
Benjamin Bouvier 04ef3d9f95 Fix: revert notification count change from read receipts PR
This was modified and then removed from the PR, and forgot to put back the previous
implementation.
2023-12-22 14:45:54 +01:00
Benjamin Bouvier 75fe874cae read receipts: don't update a RoomInfo if the read receipts haven't changed 2023-12-21 17:41:35 +01:00
Benjamin Bouvier 2a77aaa068 read receipts: update the API shape of compute_notifications 2023-12-21 15:54:19 +01:00
Benjamin Bouvier 4a686229e1 read receipts: make find_and_count_events a method of RoomReadReceipts 2023-12-21 15:54:19 +01:00
Benjamin Bouvier d64fb8241d read receipts: add test for find_and_count_events 2023-12-21 15:54:19 +01:00
Benjamin Bouvier 870d1eafb4 read receipts: add RoomReadReceipts::reset 2023-12-21 15:54:19 +01:00
Benjamin Bouvier a9905eaedd read receipts: don't count the same action multiple time per event 2023-12-21 15:54:19 +01:00
Benjamin Bouvier f1c15da87d read receipts: make count_unread_and_mention a method of RoomReadReceipts and rename it 2023-12-21 15:54:19 +01:00
Benjamin Bouvier f2b53080b6 read receipts: move RoomReadReceipts to the read_receipts.rs file 2023-12-21 15:54:19 +01:00
Benjamin Bouvier 7fe4e22076 read receipts: test count_unread_and_highlights 2023-12-21 15:54:19 +01:00
Benjamin Bouvier b6dab1a3a5 read receipts: compute_notifications doesn't need to be async 2023-12-21 15:54:19 +01:00
Andy Balaam ec833c81e0 Migrate inbound_group_session2 to fix keys incorrectly copied from old store version (#2957)
In migrate_data_for_v6, we incorrectly copied the keys in inbound_group_sessions verbatim into inbound_group_sessions2. What we should have done is re-encrypt them using the new table name, so we fix that up with a new migration here.

This caused the bug because we were looking for sessions to mark as backed up by calculating their key (from room_id and session_id) but that key did not exist, because the old sessions were stored under the incorrect keys. So no sessions were marked as backed up, and we repeatedly tried to re-mark them.
2023-12-21 14:52:02 +00:00
Ivan Enderlin de0574aa14 Merge pull request #2925 from zecakeh/create-dm-encrypted
client: Allow to create encrypted DM
2023-12-21 14:38:32 +01:00
Benjamin Bouvier fb1ff70538 Disable integration test in code coverage build
The test fails only in the codecov build, not in a local build or in the other integration test.

Needs further investigation.
2023-12-21 11:55:29 +01:00
Benjamin Bouvier d6bcbf2281 Address review comments
- copyright notice
- doc comments and better doc in general
- use static dispatch instead of &dyn T
- other misc comments
2023-12-21 11:55:29 +01:00
Benjamin Bouvier cbc832411d read receipts: add an extra num_unread_notifications field
This helps supporting cases where we want to show that a room has some activity (unread messages) but no notifications.
2023-12-21 11:55:29 +01:00
Benjamin Bouvier 843fcac3c1 read receipts: don't clone cached events for computing the read receipt state
Before this patch, we needed to clone the inner `timeline_queue` and turn it into a concrete `Vec<SyncTimelineEvent>`, just to iterate on the elements,
and because returning an iterator from a trait method is impractical. This now changes it to return the actual concrete type of `timeline_queue`, so
we don't need the extra allocations.

Ideally, matrix-sdk and matrix-sdk-base would be merged, so we don't need to use a trait at all here.
2023-12-21 11:55:29 +01:00
Benjamin Bouvier b3a8f34655 read receipts: move the unread messages and mentions counts to separate fields of RoomInfo 2023-12-21 11:55:29 +01:00
Benjamin Bouvier 73af3d9cfa Make it clear that some functions are tests or test helpers only 2023-12-21 11:55:29 +01:00
Benjamin Bouvier 09e355a7bc read receipts: add integration tests for read receipts 2023-12-21 11:55:29 +01:00
Benjamin Bouvier 9ba09b2ae8 sync: process unread notification count client-side 2023-12-21 11:55:29 +01:00
Benjamin Bouvier c9b02ad068 doc: document SlidingSyncRoomInner::timeline_queue a bit better 2023-12-21 11:55:29 +01:00
Benjamin Bouvier 07c428ec56 sdk base: add latest_read_receipt_event_id field to RoomInfo 2023-12-21 11:55:29 +01:00
Valere d4b8f88e10 Fix regenerate_olm_machine losing backup state (#2961)
* Fix regenerate_olm_machine loosing backup state

* use new helper

* clippy fix

* quick review
2023-12-21 09:43:55 +01:00
Stefan Ceriu 28a58479e7 Bring back original (slower) build style under the sequentially fla… (#2960)
* Bring back original (slower) build style under the `sequentially` flag to work around new build style hanging on older machines

* Apply suggestions from code review

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

---------

Signed-off-by: Benjamin Bouvier <public@benj.me>
Co-authored-by: Benjamin Bouvier <public@benj.me>
2023-12-21 08:15:21 +00:00
Benjamin Bouvier 320b868694 style: remove spurious fully-qualified path 2023-12-18 15:47:45 +01:00
Benjamin Bouvier 8615b1283a sliding sync: don't cause a spurious RoomInfo update
The room_info variable in this function contains the latest_event, and later it's set as the Room's room info (`inner.inner`) field.
Calling `set_latest_event` manually here will cause an update of the `RoomInfo` subscriber, while we're not done processing the full
room, and a room info update will happen anyways later (when the entire room is processed), so this one is spurious and will only
show a partial update of the fields.
2023-12-18 15:47:45 +01:00
Benjamin Bouvier 9a4d539428 sliding sync: optimize finding the room member state event
- We can look up the session meta only once, it's not useful to do it once per event as it's
loop-invariant.
- We can look at the events backwards and stop after the first room membership event we see
in that order.
2023-12-18 15:47:45 +01:00
Kévin Commaille 4d3fc44425 Put imports behind feature
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-12-18 14:07:01 +01:00
Kévin Commaille 8b878c6591 Fix test
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-12-18 14:05:01 +01:00
Kévin Commaille 738f7f0336 client: Create DM as encrypted by default
If `e2e-encryption` feature is enabled.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-12-18 13:04:39 +01:00
Valere f5fb44bd80 Maybe trigger backup at end of sync (#2939)
* maybe trigger backup at end of sync

* add test for backup upload

* missing e2e cfg

* add sliding sync tests

* fix borrow

* fix indent

* fix naming from copy/paste

* Remove extracted function

* fix clippy

* style: inline a few variables only used once into their use sites

---------

Co-authored-by: Benjamin Bouvier <public@benj.me>
2023-12-18 10:41:44 +00:00
Doug e0ba9f5a22 xtask: Use Uniffi Library mode for Kotlin too. 2023-12-18 10:34:38 +01:00
Doug b5aeea0a3b xtask: Handle multiple headers/modulemaps. 2023-12-18 10:34:38 +01:00
Ivan Enderlin 19526cea6b Merge pull request #2928 from zecakeh/qrcode-changes
verification: Expose the `QrVerificationState` and the stream for its changes
2023-12-15 12:52:50 +01:00
Ivan Enderlin 99d0b37914 Merge pull request #2951 from matrix-org/andybalaam/clarify-meaning-of-pendingbackup-sessions
Clarify the meaning of the sessions field in PendingBackup
2023-12-15 12:45:29 +01:00
Andy Balaam b21a438b7e Merge pull request #2934 from matrix-org/andybalaam/mark_sessions_as_backed_up
Provide `CryptoStore::mark_inbound_group_sessions_as_backed_up` on stores and use it in `BackupMachine::mark_request_as_sent`
2023-12-15 11:40:50 +00:00
Andy Balaam f3101baa08 Merge branch 'main' into andybalaam/mark_sessions_as_backed_up 2023-12-15 10:47:36 +00:00
Andy Balaam 0cf99db001 Delete accidentally-copied repeat_vars function
Signed-off-by: Andy Balaam <andy.balaam@matrix.org>
2023-12-15 10:47:11 +00:00
Andy Balaam a032d33d21 Remove comments in favour of a separate PR with type aliases
Signed-off-by: Andy Balaam <andy.balaam@matrix.org>
2023-12-15 10:40:36 +00:00
Andy Balaam 92212cc328 Clarify the meaning of the sessions field in PendingBackup
Signed-off-by: Andy Balaam <andy.balaam@matrix.org>
2023-12-15 10:38:56 +00:00
Kévin Commaille 6ffb0181e4 Make sure qrcode feature is additive
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-12-15 11:01:03 +01:00
dependabot[bot] 614bf942c0 build(deps): bump zerocopy from 0.7.26 to 0.7.31
Bumps [zerocopy](https://github.com/google/zerocopy) from 0.7.26 to 0.7.31.
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.7.26...v0.7.31)

---
updated-dependencies:
- dependency-name: zerocopy
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-15 10:39:21 +01:00
Andy Balaam 512509ce8b Switch to using chunk_large_query_over in mark_inbound_group_sessions_as_backed_up
Signed-off-by: Andy Balaam <andy.balaam@matrix.org>
2023-12-14 16:56:13 +00:00
Andy Balaam dfb33c9534 Move chunk_large_query_over into SqliteObjectExt so it can be reused
Signed-off-by: Andy Balaam <andy.balaam@matrix.org>
2023-12-14 16:55:36 +00:00
Andy Balaam 03aad4e965 Move repeat_vars into utils so it can be reused
Signed-off-by: Andy Balaam <andy.balaam@matrix.org>
2023-12-14 16:34:45 +00:00
Andy Balaam 9e67b6fcb1 Merge branch 'main' into andybalaam/mark_sessions_as_backed_up 2023-12-14 15:25:43 +00:00