Commit Graph

8668 Commits

Author SHA1 Message Date
Ivan Enderlin
25f893b0bb Merge branch 'main' into bnjbvr/permalink-mvp 2024-04-25 16:02:23 +02:00
Andy Balaam
415617080a Merge pull request #3337 from matrix-org/andybalaam/utd-type-info
crypto: UtdCause enum in reporting hooks and encryption event
2024-04-25 08:55:50 +01:00
Andy Balaam
2c7afc201f Merge pull request #3326 from matrix-org/andybalaam/allow-setting-encryption-settings
ffi: Expose encryption settings via FFI
2024-04-25 08:55:43 +01:00
Andy Balaam
89abb75d4d crypto: Include UTD cause in FFI EncryptedMessage 2024-04-24 12:16:17 +01:00
Andy Balaam
fd5666f55f crypto: Support unstable prefix for MSC4115 2024-04-24 08:31:31 +01:00
Benjamin Bouvier
397a26e00b ffi: add bindings for the timeline focus mode and associated functions 2024-04-23 19:02:59 +02:00
Benjamin Bouvier
a6c42404a6 tests: add integration tests for the new timeline focus mode 2024-04-23 19:02:45 +02:00
Benjamin Bouvier
7856dab56d timeline: add support for a focus mode in the timeline
This introduces the `TimelineFocus`, a new enum to declare if the
timeline is "live" aka looking at events from sync and displaying them
as they come in, or focused on an event (e.g. after clicking a
permalink).

When in the second mode, the timeline can paginate forwards and
backwards, without interacting with the event cache (as this would
require some complicated reconciliation of known events with events
received from pagination, with no guarantee that those events are event
connected in whatever way).

An event-focused timeline will also show edits/reactions/redactions in
real-time (as the events are received from the sync), but will not show
new timeline items, be they for local echoes or events received from the
sync.
2024-04-23 19:02:27 +02:00
Andy Balaam
ebcf1c434c ffi: Expose encryption_settings via FFI 2024-04-23 15:45:29 +01:00
Andy Balaam
b5e2eb6831 crypto: Add a UtdCause and code to determine it for membership 2024-04-23 15:44:39 +01:00
Andy Balaam
9d20a02a12 build: Ensure uniffi feature is properly passed on where needed 2024-04-23 15:26:51 +01:00
Benjamin Bouvier
8f5e1f3dfc timeline: include the remote event's origin in the timeline position/end
and don't assume inserting to the end means it's coming from sync — as
it won't be true for forward pagination anymore.
2024-04-23 13:45:01 +02:00
Benjamin Bouvier
d9864373f3 timeline: add the ability to set a prefix for internal IDs 2024-04-23 13:19:32 +02:00
Benjamin Bouvier
e4331ac9b8 timeline: use a string instead of a u64 to identify timeline items
This will allow to define a prefix later, to distinguish detached
timelines from live timelines.
2024-04-23 13:19:32 +02:00
Benjamin Bouvier
9547e3cee6 timeline: move populate_initial_user_receipt to TimelineInnerState
This makes the API less weird, and is more consistent with other read
receipts methods.
2024-04-23 13:19:14 +02:00
Benjamin Bouvier
ec45ce3aa6 timeline: prevent deadlock in populate_initial_user_receipt
Follow-up to 13cc7962.
2024-04-23 13:19:14 +02:00
Benjamin Bouvier
5916192fb6 ffi: don't abort RoomInfo creation if the room member invite event is missing
`Room::invite_details()` can return an error if the room member event
(the invite) is missing from the store. Usually that would be a sign
that the state is semi-broken, since there should always be such an
event for an invited room. But if it's missing, it shouldn't break the
creation of a `RoomInfo`, and just be missing from the struct.
2024-04-23 11:05:44 +02:00
Ivan Enderlin
5e347ce135 fix(ui): Timeline::send_reply correctly sets up m.mentions
fix(ui): `Timeline::send_reply` correctly sets up `m.mentions`
2024-04-23 09:43:05 +02:00
Ivan Enderlin
97ce5742e1 fix(ui): Timeline::send_reply correctly sets up m.mentions.
In https://github.com/matrix-org/matrix-rust-sdk/pull/2691, I suppose
the way `add_mentions` is computed is… wrong. `AddMentions` is used to
automatically infer the `m.mentions` of the reply event based on the
replied event. The way it was computed was based on the reply event
`mentions`, which seems wrong: if the reply contains mentions, then the
sender should be part of it? Nah. That's a bug. We want the reply event
to automatically mention the sender of the replied event if and only
if it's not the same as the current user, i.e. the sender of the reply
event.

This patch fixes the `add_mentions` calculation. This patch also updates
a test and adds another test to ensure that `m.mentions` is correctly
defined when replying to an event.
2024-04-23 09:30:21 +02:00
Benjamin Bouvier
13cc7962e7 timeline: prevent deadlock in replace_with_initial_events
The `state` lock was taken at the top level of this function, and
indirectly implicitly in the `set_fully_read_event` function. This fixes
it, and adds a regression test.
2024-04-22 20:49:12 +02:00
Benjamin Bouvier
c471ee42ab paginator: select how many events to retrieve from the /messages query 2024-04-22 16:58:37 +02:00
Benjamin Bouvier
8e2fdd9200 paginator: select how many events to retrieve from the initial /context query 2024-04-22 16:58:37 +02:00
Benjamin Bouvier
289e2ac92b test: silently skip the room summary test on CI, if the server doesn't support it 2024-04-22 14:55:47 +02:00
Benjamin Bouvier
90c35b6b34 room preview: add support for MSC3266, room summary 2024-04-22 14:55:47 +02:00
Benjamin Bouvier
fd96360228 dependencies: bump ruma
Honestly, I'm not sure how the retry-after that's a fixed point in time
in the future should be handled, open to suggestions here…
2024-04-22 14:55:47 +02:00
Benjamin Bouvier
bd65c77534 dependencies: use a fork of Ruma for the time being 2024-04-22 14:55:47 +02:00
Benjamin Bouvier
4398052d94 timeline: after an event cache update lag, fetch previous events back from the cache
Fixes #3311.

When the timeline is lagging behind the event cache, it should not only
clear what it contains (because it may be lagging some information
coming from the event cache), it should also retrieve the events the
cache knows about, and adds them as if they were "initial" events.

This makes sure that the event cache's events and the timeline's events
are always the same, and that, in the case of a lag, there won't be any
missing chunks (caused by the event cache back-pagination being further
away in the past, than what's displayed in the timeline).

The lag behind a bit too hard to reproduce, I've not included a test
here; but I think this should be the right move.
2024-04-22 11:18:19 +02:00
Ivan Enderlin
b03ae97580 Merge pull request #3346 from matrix-org/dependabot/cargo/rustls-0.21.11
chore(deps): bump rustls from 0.21.10 to 0.21.11
2024-04-22 10:48:02 +02:00
dependabot[bot]
a157f2eb97 chore(deps): bump rustls from 0.21.10 to 0.21.11
Bumps [rustls](https://github.com/rustls/rustls) from 0.21.10 to 0.21.11.
- [Release notes](https://github.com/rustls/rustls/releases)
- [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustls/rustls/compare/v/0.21.10...v/0.21.11)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-19 19:53:20 +00:00
Benjamin Bouvier
db5151d612 timeline: rename variables around reaction redaction 2024-04-19 15:15:11 +02:00
Benjamin Bouvier
621b47d763 timeline: refactor handling of local redactions too 2024-04-19 15:15:11 +02:00
Benjamin Bouvier
650281b534 timeline: refactor handling of local events to use a single method 2024-04-19 15:15:11 +02:00
Benjamin Bouvier
25ee247fe9 timeline: simplify redaction
Redaction was requiring the `RoomRedactionEventContent`, which was
eventually unused in all the code paths; this removes it.

Also adds lots of documentation for the different types of reaction that
can happen in the timeline.
2024-04-19 15:15:11 +02:00
Andy Balaam
1f524f2dec Merge pull request #3327 from matrix-org/andybalaam/expose-wait-e2ee
ffi: Expose Encryption::wait_for_e2ee_initialization_tasks
2024-04-19 11:26:06 +01:00
Andy Balaam
a3e6a070d5 Merge pull request #3338 from matrix-org/kegan/drop-store
bugfix: ensure the SessionStore is cleared when regenerating the OlmMachine
2024-04-19 09:05:01 +01:00
Andy Balaam
381c02d21e crypto: Test that the sqlite store empties its session cache when asked 2024-04-18 13:47:36 +01:00
Andy Balaam
558d133e14 crypto: Test that regenerate_olm clears the store cache 2024-04-18 11:50:22 +01:00
Kegan Dougal
3a99d52e84 Apply suggestions from code review
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
Signed-off-by: Kegan Dougal <7190048+kegsay@users.noreply.github.com>
2024-04-18 10:34:54 +01:00
Benjamin Bouvier
4325812b05 test: try a different strategy for waiting for the sync to stabilize 2024-04-18 11:29:24 +02:00
Benjamin Bouvier
845f65400a test: add integration test for a room preview 2024-04-18 11:29:24 +02:00
Benjamin Bouvier
d5cbf77b84 tests: prefix some more tests with test_ 2024-04-18 11:29:24 +02:00
Benjamin Bouvier
f322dcd200 sdk: give the ability to get a room's preview 2024-04-18 11:29:24 +02:00
Kegan Dougal
8cb778e9d9 CHANGELOG 2024-04-18 10:11:52 +01:00
Kegan Dougal
09955cf0db bugfix: ensure the SessionStore is cleared when regenerating the OlmMachine
This fixes https://github.com/matrix-org/matrix-rust-sdk/issues/3110
2024-04-18 10:08:15 +01:00
Benjamin Bouvier
f7329c71bb test: test that getting kicked/banned marks the room as left in sliding sync matrix-sdk-crypto-ffi-0.4.0 2024-04-15 11:41:37 +02:00
Benjamin Bouvier
b977a239c3 tests: prefix more tests with test_ 2024-04-15 11:41:37 +02:00
Benjamin Bouvier
3aa62a265d sliding sync: also mark kicked/banned users as leaving a room 2024-04-15 11:41:37 +02:00
Benjamin Bouvier
fc4cd530fb event cache: introduce the Paginator API (#3309)
This introduces a new helper object to run arbitrary pagination requests, backwards- or forward-. At the moment they're disconnected from the event cache, although I've put the files there for future convenience, since at some point we'll want to merge the retrieved events with the cache (? maybe).

This little state machine makes it possible to retrieve the initial data, given an initial event id, using the /context endpoint; then allow stateful pagination using a paginator kind of API. Paginating in the timeline indicates whether we've reached the start/end of the timeline.

The test for the state subscription is quite extensive and makes sure the basic functionality works as intended.

Some testing helpers have been (re)introduced in the SDK crate, simplifying the code, and introducing a better `EventFactory` / `EventBuilder` pattern than the existing one in the `matrix-sdk-test` crate. In particular, this can make use of some types in `matrix-sdk`, notably `SyncTimelineEvent` and `TimelineEvent`, and I've found the API to be simpler to use as well.

Part of #3234.
2024-04-12 17:57:10 +02:00
Andy Balaam
8a313df6a4 ffi: Expose Encryption::wait_for_e2ee_initialization_tasks 2024-04-12 14:20:17 +01:00
Benjamin Bouvier
7c68096237 multiverse: allow setting a proxy
This is handy when running mitmproxy on multiverse.
2024-04-11 16:45:05 +02:00