Commit Graph

13223 Commits

Author SHA1 Message Date
Ivan Enderlin 86ed582744 feat(ui): RoomDataProvider has profile_from_latest_event.
This patch renames `RoomDataProvider::profile`
to `::profile_from_user_id`. This patch also adds
`RoomDataProvider::profile_from_latest_event`.
2023-10-02 09:49:56 +02:00
Ivan Enderlin 5c55c2c51f feat(base): Rename LatestEvent::sender_profile to ::has_sender_profile. 2023-10-02 09:49:56 +02:00
Ivan Enderlin c0a3cc478d feat(base): LatestEvent has more methods.
This patch implements `LatestEvent::sender_display_name()`,
`::sender_name_ambiguous()` and `::sender_avatar_url()`.
2023-10-02 09:49:56 +02:00
Ivan Enderlin 83e7d7df11 feat(base): LatestEvent can hold a MinimalRoomMemberEvent.
This patch adds a `sender_profile: Option<MinimalRoomMemberEvent>`
field. Thus, `cache_latest_events` now receives an
`Option<&StateChanges>` and an `Option<&Store>`. The `StateChanges`
is used to read the most recent sender profile, otherwise the sender
profile will be fetch from the storage.
2023-10-02 09:49:56 +02:00
Ivan Enderlin f71a6fc738 feat(base): Latest event is represented by the new LatestEvent type.
This patch adds a new `LatestEvent` type. It wraps the
`SyncTimelineEvent` that was used before. The idea is to add more fields
onto this `LatestEvent` struct, but this patch starts easy by using
`LatestEvent` everywhere where it's required.
2023-10-02 09:49:56 +02:00
Ivan Enderlin 9027607347 doc(ui): Format doc. 2023-10-02 09:49:56 +02:00
Ivan Enderlin 84b1b741a3 feat(ui): all_rooms requires m.room.member: $LAZY.
This patch updates `all_rooms` to require the `m.room.member` state set
to `$LAZY`. That way, it's more likely to get the `m.room.member` event
associated to the latest event without needing to sync all the members.
2023-10-02 09:49:56 +02:00
Ivan Enderlin f7c008af3c chore(ui): Add repository and license to Cargo.toml. 2023-10-02 09:41:29 +02:00
kegsay 58e15f812d oidc: allow http scheme during discovery (#2642)
This is to enable entirely local stacks of Element X to work correctly. It's mostly seamless (no ffi changes) because it ties into `ClientBuilder.insecure_server_name_no_tls()`.

---------

Co-authored-by: Benjamin Bouvier <public@benj.me>
2023-09-29 11:29:30 +00:00
Benjamin Bouvier 9cc9221808 notifications: match decryption errors more precisely when waiting for decryption in the background 2023-09-29 12:37:16 +02:00
Benjamin Bouvier e679182fb5 fix(notifications): don't hard-fail if decrypting failed
Before this commit, a call to get_notification would fail if decrypting failed on the first attempt, because `Room::decrypt_event` will hard-fail if the key wasn't found.
2023-09-29 12:37:16 +02:00
Benjamin Bouvier 787a85615c chore(notifications): tweak logs in notification client 2023-09-29 12:37:16 +02:00
Benjamin Bouvier 6a5a4db5fc fix(notifications): add a mutex to serialize e2ee encryption requests 2023-09-29 12:37:16 +02:00
Benjamin Bouvier 1cedd1097a chore(notifications): rename sliding_sync_mutex to notification_sync_mutex 2023-09-29 12:37:16 +02:00
Benjamin Bouvier 2677d16f2e chore: look ma i'm a 10x engineer ok 2023-09-29 12:25:52 +02:00
Benjamin Bouvier 1e5e13bb19 chore: make use of StaticAccountData in one extra location 2023-09-29 12:25:52 +02:00
Benjamin Bouvier 1eeee288b9 chore: move unsigned_device_keys to StaticAccountData too 2023-09-29 12:25:52 +02:00
Benjamin Bouvier e4fd8e7ac6 chore: move methods from ReadOnlyAccount to StaticAccountData 2023-09-29 12:25:52 +02:00
Valere ab2f18df3b Add new API to request missing secrets (#2641) 2023-09-29 12:12:34 +02:00
Benjamin Bouvier a1f6e2fb16 chore: clippy + remove spurious Arc 2023-09-28 17:21:53 +02:00
Benjamin Bouvier 8f541c9a09 chore: remove ReadOnlyAccount from the Account
And use the `self.store.account()` when we really need the `ReadOnlyAccount`. Also cache the immutable account data in this Account.
2023-09-28 17:21:53 +02:00
Benjamin Bouvier c01d2d990c chore: use StaticAccountData in more places
Sorry, this commit is a bit big. What happened is that I've pulled a thread: put a `StaticAccountData` there, look at caller; it seems to use only a
static account too, so keep up.

The only contender was the `OwnUserIdentity` data structure which really wants to sign things. Lucky for us, we could pass it a `ReadOnlyAccount`
from a store, in those cases, since we always had a `Store` hanging around; in the future it'll read it from the store cache, which is somewhat
identical.
2023-09-28 17:21:53 +02:00
Benjamin Bouvier 13be4b0dce chore: use a StaticAccountData in the Sas data structures 2023-09-28 17:21:53 +02:00
Benjamin Bouvier 650d99a875 chore: rename account_info/get_account_info to static_account/get_static_account 2023-09-28 17:21:53 +02:00
Benjamin Bouvier 1c311555ef chore: put the immutable parts of ReadOnlyAccount into its own data struct 2023-09-28 17:21:53 +02:00
Kévin Commaille f115bd0e25 base: Fix typo
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-09-28 16:54:03 +02:00
Kévin Commaille 4595e2c064 indexeddb: Close DB less often during migrations
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-09-28 16:54:03 +02:00
Kévin Commaille f3b8bdbe1e indexeddb: Migrate RoomInfo to new format
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-09-28 16:54:03 +02:00
Kévin Commaille 23b34bfc2b indexeddb: Make sure each migration is discrete
We might need to rely on the data in the DB to already be corrected
before using it for another migration

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-09-28 16:54:03 +02:00
Kévin Commaille d4f0f7a704 sqlite: Migrate RoomInfo to new format
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-09-28 16:54:03 +02:00
Kévin Commaille 0856cf10fe base: Add migration helpers for converting serialized format of RoomInfo
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-09-28 16:54:03 +02:00
Kévin Commaille cd4bc7a62c base: Return m.room.create event's content even if it is redacted
Starting with room version 11, all fields are kept when the event is redacted

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-09-28 16:54:03 +02:00
Kévin Commaille acfb999e76 base: Make BaseRoomInfo compatible with room version 11
By copying the sender field as the creator field of m.room.create's event content

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-09-28 16:54:03 +02:00
Benjamin Bouvier 79f408b511 feat: automatically reload the tracked users when getting the cache 2023-09-28 16:37:52 +02:00
Benjamin Bouvier c18ac12ce9 Apply suggestions from code review
Co-authored-by: Damir Jelić <poljar@termina.org.uk>
2023-09-28 16:37:52 +02:00
Benjamin Bouvier 216b3b9d77 feat: add a dummy StoreCacheGuard too, and make use of it 2023-09-28 16:37:52 +02:00
Benjamin Bouvier 00d6b2d2ae chore: rename Store::load_tracked_users to Store::ensure_sync_tracked_users 2023-09-28 16:37:52 +02:00
Benjamin Bouvier 2499d13839 chore: remove outdated code comment 2023-09-28 16:37:52 +02:00
Benjamin Bouvier 074bcca02e feat: introduce dummy crypto cache for the store 2023-09-28 16:37:52 +02:00
Benjamin Bouvier 851b3f2982 chore(crypto): simplify Store::load_tracked_users 2023-09-28 16:37:52 +02:00
Daniel Abramov 585508f461 sdk(widget): Add the matrix (i/o) part 2023-09-28 16:01:26 +02:00
Hubert Chathi 4478826a2f Fix a typo 2023-09-28 15:31:25 +02:00
Marco Romano 0158422dcd Bump ruma
- Bumps ruma to include https://github.com/ruma/ruma/pull/1665
- Enables ruma `compat-arbitrary-length-ids` flag instead of using the now deprecated `lax-id-validation`
2023-09-28 14:01:18 +02:00
Damir Jelić 1f695bf26e Move most of our locks in the Client into the ClientLocks struct 2023-09-28 13:06:09 +02:00
Damir Jelić e37cfe6036 Don't use a static for the mark_room_as_dm lock
Using a static lock would prevent two Client instances to call the
method at the same time.

We're going to assume that people won't have multiple Client instances
for the same user, in which case a static lock would have been helpful.

Co-authored-by: Jonas Platte <jplatte@matrix.org>
2023-09-28 13:06:09 +02:00
Richard van der Hoff bcbb7c61f8 Enable the tests for encrypted indexeddb stores
Empirically, these seem to work for me, so let's re-enable them
2023-09-28 12:53:40 +02:00
Valere 4c432a66b4 Distinguish between changed and unchanged user identities (#2618) 2023-09-28 10:14:09 +02:00
Damir Jelić 24a203a126 Ensure that we can't try to mark two rooms as a DM at the same time 2023-09-27 16:24:57 +02:00
Jonas Platte cbb7b24cb5 Rewrite public widget API 2023-09-27 14:45:33 +02:00
Jonas Platte ae524b3fa6 ffi: Use FFI's tokio runtime explicitly for acquire_permissions 2023-09-27 13:13:27 +02:00