Commit Graph

13223 Commits

Author SHA1 Message Date
Benjamin Bouvier e49d62988b timeline queue: tiny refactorings
A few renamings here and there, making use of `as_variant!` a bit more,
adding a few comments,…
2024-05-20 11:18:43 +02:00
Benjamin Bouvier 8867a03c07 memory state store: correctly save user avatar url
With a regression test.

Fixes #3432.
2024-05-20 11:03:07 +02:00
Kévin Commaille 6c18bcf748 sdk: Improvements around generate_image_thumbnail (#3415)
* sdk: Return a Thumbnail from generate_image_thumbnail

We have already all the data for it.
Also fixes an error where the thumbnail format was assumed to always be
JPEG.

* sdk: Allow to select the format of the generated thumbnail

Sending an attachment could often fail if the image crate
cannot encode the thumbnail to the same format as the original.
This allows to select a known supported format to always
be able to generate a thumbnail.

* sdk: Do not return error of thumbnail generation for SendAttachment

Since the thumbnail is optional, failing to generate it should not
stop us from sending the attachment.

* Apply code review fixes
* sdk: Split attachment tests in separate file
* sdk: Add integration tests for generating thumbnails
* Revert wiremock debug log level

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-05-17 16:48:59 +02:00
Benjamin Bouvier 4cc67e9002 room list/notification services: don't request the room avatar since it's always provided
It's always provided in the `avatar` response in the field, which
sliding sync's using by default, so there's no need to request the
`m.room.avatar` event too.
2024-05-17 15:14:47 +02:00
Benjamin Bouvier bac0654a63 sliding sync: don't store the server-computed name in place of the raw name event
If we want to be able to note the absence of a room name, we shouldn't
take the name returned by the server (which may be computed, and thus
always be non-null). This way, we can expose both the name contained in
the m.room.name event as well as the computed name everywhere.

A consequence of this is that the room list service must now ask for the
m.room.name event as part of the required state for every room.
2024-05-17 15:14:47 +02:00
Valere 6111beded7 ffi: Expose ed25519/curve25519 keys in bindings (#3420) 2024-05-17 13:55:18 +02:00
Benjamin Bouvier b0558a002b day divider: don't recall a previous item if it's scheduled for deletion
With a regression test that didn't pass on main, and would incorrectly
remove the read marker, because it tried to replace the day divider at
(4), that was just scheduled for deletion in the previous loop
iteration.
2024-05-17 11:59:40 +02:00
Benjamin Bouvier c6f4ca09f5 day divider: simplify control flow in handle_event 2024-05-17 11:59:40 +02:00
Benjamin Bouvier 532f3a3ee8 day divider: add new invariant, a read marker should not disappear 2024-05-17 11:59:40 +02:00
Jorge Martín 3914e31461 ffi: Add the user's display name to RoomMembership timeline content
This is useful to properly format membership state events.
2024-05-17 10:45:48 +02:00
Damir Jelić a48d604b3f chore: Downgrade prost-derive, since the latest version was yanked 2024-05-17 10:40:31 +02:00
Benjamin Bouvier e486da4b08 cross-process lock: add a log line when aborting the previous renew task 2024-05-16 17:16:15 +02:00
Ivan Enderlin 67e5820643 feat(sdk): AsVectorSubscriber becomes AsVector.
This patch removes the possibility to have `LinkedChunk` as an
`ObservableVector` via a `Stream`, which was initially the goal of
`AsVectorSubscriber`. Having a `Stream` was more complex than required
for the integration inside `EventCache`. This patch keeps the same code
but renames `AsVectorSubscriber` into `AsVector`. A new internal type,
`UpdateToVectorDiff`, applies the algorithm itself and maintains its
own state, making it possible to re-introduce a `Stream` later if we
want to.
2024-05-16 16:57:01 +02:00
Benjamin Bouvier 7ae0bcecfd room preview: rejigger public API to pass a RoomOrAliasId in place of a RoomId to get_room_preview 2024-05-16 10:58:41 +02:00
Benjamin Bouvier 1fd29f7b6d room preview: allow passing through a list of servers to discover a room with MSC3266
Fixes #3395.`
2024-05-16 10:58:41 +02:00
Benjamin Bouvier c8f6fe4f6d event cache/timeline: reuse the Paginator when running back-paginations (#3373)
* event cache: reuse the paginator internally

Fixes #3355.

* event cache: move the `pagination_token_notifier` into the `RoomPaginationData` as well

* event cache: introduce a `RoomPagination` API object and move code around

Only code motion. No changes in functionality.

* event cache: remove "paginate" (et al.) in `RoomPagination` method names

No changes in functionality, just renamings.

* event_cache/timeline: have the event cache handle restarting a back-pagination that failed under our feet

When a timeline reset happens while we're back-paginating, the event
cache method to run back pagination would return an success result
indicating that the pagination token disappeared. After thinking about
it, it's not the best API in the world; ideally, the backpagination
mechanism would restart automatically.

Now, this was handled in the timeline before, and the reason it was
handled there was because it was possible to back-paginate and ask for a
certain number of events. I've removed that feature, so that
back-pagination on a live timeline matches the capabilities of a
focused-timeline back-pagination: one can only ask for a given number of
*events*, not timeline items.

As a matter of fact, this simplifies the code a lot by removing many
data structures, that were also exposed (and unused, since recent
changes) in the FFI layer.

* Address review comments
2024-05-16 10:22:05 +02:00
Damir Jelić 21804ab313 chore(crypto): Add a missing changelog entry 2024-05-16 09:33:12 +02:00
Ivan Enderlin 14252807a2 Merge pull request #3418 from zecakeh/attachment-mentions
sdk: Allow to send mentions with attachments
2024-05-16 09:06:01 +02:00
Ivan Enderlin d1fad85c5f chore(sdk): Make Clippy happy. 2024-05-16 08:47:42 +02:00
Ivan Enderlin 38932e7e03 doc(sdk): Add moooooar documentation.
This patch adds documentation that explains how `AsVectorSubscriber`
works.
2024-05-15 22:16:18 +02:00
Ivan Enderlin 397a970636 doc+test(sdk): Add documentation for AsVectorSubscriber + improve tests.
This patch add more documentation for `AsVectorSubscriber` and improve
the tests.
2024-05-15 22:16:18 +02:00
Ivan Enderlin 8d2db9d35a chore(sdk): assert_items_eq is shared amongst several test modules.
This patch moves the `assert_items_eq` macro in a place where it's
accessible to several test modules. This is going to be useful for next
patches.
2024-05-15 22:16:18 +02:00
Ivan Enderlin 8ee0bbb22e feat(sdk): Add Update::ReattachItems and Update::ReattachItemsDone.
This patch adds 2 new updates: `ReattachItems` and `ReattachItemsDone`.
It's useful to optimise insertion, esp. in `AsVectorSubscriber` but
almost maybe in database.
2024-05-15 22:16:18 +02:00
Ivan Enderlin 672bb0229b feat(sdk): Rename Update::TruncateItems to Update::DetachLastItems.
This patch renames `TruncateItems` to `DetachLastItems`. It's
technically the same things, but the fields are different: `chunk:
ChunkIdentifier` and `length: usize` become a unique `at: Position`. The
spirit is the same but the semantics is a bit different.

This patch, with this renaming, also prepares the next commits.
2024-05-15 22:09:01 +02:00
Ivan Enderlin b894b700c7 feat(sdk): Rename Update::InsertItems to Update::PushItems.
First off, this patch renames `Update::InsertItems` to
`Update::PushItems` because all items insertions happen at the end of
a chunk. Let's reflect that. `InsertItems` would have meant that it's
possible to insert at any position, but it's not what happens by design.

Second, this patch renames `Update::PushItems::at` to
`Update::PushItems::position_hint`. Indeed, the `at` field would have
meant that the position is specific whilst it's not. It's just a hint to
make the life of update readers simpler. It's also a good way to improve
performance in some cases: since items are pushed, to know the new
position of the items, one has to read the position of the previous last
item and compute the new position from there. Having `position_hint`
help to prevent this dance and save the cost of a reading. That's also
why the field has been renamed to `position_hint`, it's a hint.
2024-05-15 22:08:54 +02:00
Ivan Enderlin 9af57c7a60 feat(sdk) AsVectorSubscriber::new now receives the initial chunk lengths.
This patch updates the constructor of `AsVectorSubscriber` to receive
the initial chunk lengths so that this type doesn't have to guess what
to do when receiving an unknown chunk identifier. `AsVectorSubscriber`
is de facto synchronized with its source `LinkedChunk` when created.
2024-05-15 22:08:27 +02:00
Ivan Enderlin 725d7bbc97 !tmp First draft of the subscribe_as_vector API. 2024-05-15 22:05:52 +02:00
Ivan Enderlin 2d10ea4dc9 chore(sdk): Use pin-project-lite in matrix-sdk.
This patch moves the `pin-project-lite` dependency from `matrix-sdk-ui`
to the workspace, and uses it in `matrix-sdk`.
2024-05-15 22:05:52 +02:00
Kévin Commaille e50b574f12 sdk: Allow to send mentions with attachments
Particularly useful for captions

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-05-15 16:40:06 +02:00
Damir Jelić 35173347fd chore: Bump the vodozemac version
This gives us the necessary primitives for the QR code login feature.
2024-05-15 15:01:53 +02:00
Ivan Enderlin 64c5a83e33 Merge pull request #3413 from zecakeh/send-attachment-path
ui: Take a `PathBuf` to send an attachment
2024-05-15 13:24:09 +02:00
Kévin Commaille 8da3922ff0 sdk: Rename SendAttachment's url field to filename
It is name filename before and after, and it is not a url.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-05-15 13:00:49 +02:00
Kévin Commaille eba5efc829 Merge branch 'main' into send-attachment-path
Signed-off-by: Kévin Commaille <76261501+zecakeh@users.noreply.github.com>
2024-05-15 10:57:08 +02:00
Ivan Enderlin 7ed6db9758 Merge pull request #3406 from zecakeh/edit-without-relation
ui: Make Timeline::edit take a RoomMessageEventContentWithoutRelation
2024-05-15 10:55:21 +02:00
Kévin Commaille 32c7a1ab78 ui: Take a PathBuf to send an attachment
I found the previous API confusing. Firstly, the parameter name was "filename" when we want a file path.
Secondly, we take a `String` when we want a `Path`.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-05-15 10:50:26 +02:00
Damir Jelić cbb92cacce feat(crypto): Add support to import/export the newly added secrets bundle 2024-05-14 11:46:56 +02:00
Damir Jelić 402d620608 feat(crypto): Add a SecretsBundle type 2024-05-14 11:46:56 +02:00
Doug b57dbd8d1a xtask: Allow passing multiple targets to Swift's build-framework.
* Fix CI
2024-05-14 11:33:13 +02:00
Damir Jelić aa6bbc1a0f feat(crypto): Add data types to parse QR codes from MSC4108 2024-05-14 10:47:22 +02:00
Damir Jelić 6672302684 chore: Make the url crate a workspace dependency 2024-05-14 10:47:22 +02:00
Kévin Commaille 9e4125bb39 ui: Make Timeline::edit take a RoomMessageEventContentWithoutRelation
Like send_reply.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-05-13 20:25:44 +02:00
Kévin Commaille cb452802bb chore: Upgrade ruma
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-05-13 20:25:43 +02:00
Benjamin Bouvier da249bbc51 crypto: remove the fake crypto store test for olm session wedging
Two reviewers were suspicious the test wasn't very useful, so I propose
to hereby remove it.
2024-05-13 18:30:25 +02:00
Benjamin Bouvier c16bfd3234 timeline: reuse internal id when adding pending replied-to details to an item
Fixes #3379.
2024-05-13 18:29:34 +02:00
Benjamin Bouvier 83427b325c ci: use the latest synapse-service image with msc3266
And re-enable the room preview test there.
2024-05-13 18:11:07 +02:00
Andy Balaam b99e103704 Merge pull request #3409 from matrix-org/andybalaam/disable-flaking-nse-test
Ignore a flaking test
2024-05-13 16:55:17 +01:00
Andy Balaam 6d6f470e11 Ignore a flaking test 2024-05-13 16:42:22 +01:00
Benjamin Bouvier 94d3758a0d base: sort the heroes in the computed display name alphabetically 2024-05-13 15:11:57 +02:00
Andy Balaam 4b1d03f229 Merge pull request #3343 from matrix-org/andybalaam/test-store-cache-drop
crypto: Add a standalone integration test for the NSE race
2024-05-13 14:09:40 +01:00
Andy Balaam 06825c6385 crypto: Test for the NSE race bug #3110
Adds a test for https://github.com/matrix-org/matrix-rust-sdk/issues/3110
that fails before the fix and passes afterwards.
2024-05-13 13:55:04 +01:00