Commit Graph

13223 Commits

Author SHA1 Message Date
Ivan Enderlin
29e19b729b chore(ui): Remove TimelineController::add_events_at.
This patch removes `TimelineController::add_events_at` since it's a
non-public method and it's unused.
2025-01-28 15:43:06 +01:00
Ivan Enderlin
20c1eff391 refactor(ui): The Timeline no longer use add_events_at.
This patch replaces all uses of `TimelineController::add_events_at` by
`TimelineController::handle_remote_events_with_diffs` in the `Timeline`
itself.

The idea is to remove `add_events_at`, as we currently have 2 ways to
add or to handle remote events in the `Timeline`. We want a single one,
because it's simpler!
2025-01-28 15:43:06 +01:00
Ivan Enderlin
3e40db3d7f test(ui): Tests no longer use add_events_at.
This patch replaces all uses of `TimelineController::add_events_at` by
`TimelineController::handle_remote_events_with_diffs` in the tests.

The idea is to remove `add_events_at`, as we currently have 2 ways to
add or to handle remote events in the `Timeline`. We want a single one,
because it's simpler!
2025-01-28 15:43:06 +01:00
Kévin Commaille
8ca5983093 feat(sqlite): Implement EventCacheStoreMedia for SqliteEventCacheStore
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:38:18 +01:00
Kévin Commaille
144f568a5c feat(base): Implement EventCacheStoreMedia for MemoryStore
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:37:30 +01:00
Kévin Commaille
34c7dd48ae refactor(base): Use struct for media content in the MemoryStore
It is already a 3-tuple and we want to add more data so it will be clearer to use a stuct with named fields.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:36:16 +01:00
Kévin Commaille
6c7d8c16bb feat(base): Add macro for integration tests of EventCacheStoreMedia
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:36:16 +01:00
Kévin Commaille
2c930df8aa feat(base): Add MediaService
This is an API to handle the MediaRetentionPolicy with a lower level
EventCacheStoreMedia trait.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:36:06 +01:00
Kévin Commaille
834bed2b1a feat(base): Add MediaRetentionPolicy
This will be used as a configuration to decide whether or not to keep
media in the cache, allowing to do periodic cleanups to avoid to have
the size of the media cache grow indefinitely.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:35:26 +01:00
Valere
8d530ef220 Merge pull request #4558 from matrix-org/valere/memory_store_consistent_with_other_stores
refactor(crypto): Make memory store behave more like other stores
2025-01-28 15:27:03 +01:00
Valere
542d68dcda fix(test): Properly set up test crypto memory store by saving own device 2025-01-28 15:02:30 +01:00
Valere
50696a0d74 refact(mem_store) Add a global save change lock similar to other stores 2025-01-28 15:02:30 +01:00
Valere
182fc6fd8f refact(mem_store): Ser/Deser inbound group sessions 2025-01-28 15:02:30 +01:00
Valere
fe85cddf88 refact(mem_store): Serialize/Deserialise olm sessions 2025-01-28 15:02:30 +01:00
Valere
9ff3761cac refact(mem_store): Serialize account and cache static account data 2025-01-28 15:02:30 +01:00
Valere
a311dcbd3e refact(mem_store): Replace unwrap with expect 2025-01-28 15:02:30 +01:00
Andy Balaam
447bd67fe1 feat(crypto): Ignore to-device messages from dehydrated devices 2025-01-28 12:57:30 +00:00
Andy Balaam
d8ba2b521c refactor(crypto): extract a method from a test that I will re-use later 2025-01-28 12:57:30 +00:00
Damir Jelić
8de15429fb chore: Fix a typo 2025-01-28 12:48:55 +01:00
Damir Jelić
3f398d8934 chore(ui): Move the SyncService stop logic out of the State::Running branch 2025-01-28 12:48:55 +01:00
Damir Jelić
f8ec957193 doc(ui): Reword the doc comment for the is_supervisor_task_running method 2025-01-28 12:48:55 +01:00
Damir Jelić
7cc121ab38 docs(ui): Clarify that the supervisor encapsulates the child tasks in its own task 2025-01-28 12:48:55 +01:00
Damir Jelić
8a4918309a refactor(ui): Rename the abortion sender in the SyncService
Termination aligns better with the existing terminology.
2025-01-28 12:48:55 +01:00
Damir Jelić
30d7fac927 refactor(ui): Remove some unneeded references from the SyncServiceInner 2025-01-28 12:48:55 +01:00
Damir Jelić
be71c6df56 docs: Document that the SyncService requires MSC4186 2025-01-28 12:48:55 +01:00
Damir Jelić
06ad67f99c docs(ui): Polish the documentation of the SyncService a bit 2025-01-28 12:48:55 +01:00
Damir Jelić
28fb6f7c27 fix(ui): Shutdown the child tasks if the channel got closed in the supervisor 2025-01-28 12:48:55 +01:00
Damir Jelić
842d32d41b refactor(ui): Prettify the two sync tasks a bit 2025-01-28 12:48:55 +01:00
Damir Jelić
b52cf8327a refactor(ui): Remove some early returns from the sync service
Now that the various match branches in the start and stop method of the
SyncService are minimized we can remove the early returns.

This should allow us to more easily add new branches.
2025-01-28 12:48:55 +01:00
Damir Jelić
d14526f161 refactor(ui): Move the task spawning functions under the supervisor 2025-01-28 12:48:55 +01:00
Damir Jelić
1b8a6b705c refactor(ui): Move the expiration of the sync services closer to the action 2025-01-28 12:48:55 +01:00
Damir Jelić
7c2b15fe86 refactor(ui): Move the spawning of the child tasks into the supervisor 2025-01-28 12:48:55 +01:00
Damir Jelić
3085f05d51 refactor(ui): Create a Supervisor for the SyncService
The supervisor is defined as two optional fields that are set and
removed at the same time.

This patch converts the two optional fields into a single optional
struct. The fields inside the struct now aren't anymore optional. This
ensures that they are always set and destroyed at the same time.
2025-01-28 12:48:55 +01:00
Damir Jelić
4344e06707 refactor(ui): Rename the scheduler task to supervisor task
From cambridge a scheduler is defined as:
    > someone whose job is to create or work with schedules

While supervisor is defined as:
    > a person whose job is to supervise someone or something

Well ok, that doesn't tell us much, supervise is defined as:
    > to watch a person or activity to make certain that everything is done correctly, safely, etc.:

In conclusion, supervising a task is the more common and better
understood terminology here I would say.
2025-01-28 12:48:55 +01:00
Damir Jelić
173ec75bb3 refactor(ui): Move common data of the SyncService under a lock
Previously we had a lock protecting an empty value, but the logic wants
to protect a bunch of data in the SyncService.

Let's do the usual thing and create a SyncServiceInner which holds the
data and protect that with a lock.
2025-01-28 12:48:55 +01:00
Ivan Enderlin
1d3f8bf898 doc(ui): Update the CHANGELOG. 2025-01-28 09:54:31 +01:00
Ivan Enderlin
5b3b87d3e2 chore(ui): Rename Timeline::subscribe_batched to ::subscribe.
This patch renames `Timeline::subscribe_batched` to
`Timeline::subscribe`. Since the `Timeline::subscribe` method has been
removed because unused, it no longer makes sense to have a “batched”
variant here. Let's simplify things!
2025-01-28 09:54:31 +01:00
Ivan Enderlin
6dc5b33d87 chore(ui): Remove useless trace!.
This patch removes useless `trace!` calls.
2025-01-28 09:54:31 +01:00
Richard van der Hoff
408b843156 test: fix cross-signing in legacy dehydrated device test
We missed a call to `sign_device_keys`. Pull out a test helper to make it more
obvious where this code is coming from.
2025-01-27 17:49:47 +00:00
Ivan Enderlin
0820170261 doc(ui): Update the CHANGELOG. 2025-01-27 17:02:09 +01:00
Ivan Enderlin
254ac6f2ce refactor(ui): Unify the Timeline pagination API.
This patch simplifies the `Timeline` pagination API as follows:

- a unique `paginate_backwards` method (no more
  `focused_paginate_backwards` and `live_paginate_backwards`),
- a unique `paginate_forwards` method (no more
  `focused_paginate_forwards`, the `live` variant was absent).

The idea is to unify pagination by hiding the `live` and `focused` mode.
It was already partially the case with `paginate_backards`, but the
`live` and `focused` variants were also present. I believe it creates
an unnecessary confusion.
2025-01-27 17:02:09 +01:00
Ivan Enderlin
468a7ac883 doc(ffi): Remove useless #[cfg(doc)] imports.
This patch removes 2 useless imports that are behind a `#[cfg(doc)]` but
never used.
2025-01-27 17:02:09 +01:00
Richard van der Hoff
3e610c80e1 Merge pull request #4581 from matrix-org/rav/refactor_share_keys
crypto: refactor the room key sharing strategies
2025-01-27 15:51:04 +00:00
Richard van der Hoff
f43edbd31f refactor(crypto): split up split_devices_for_user_for_error_on_verified_user_problem_strategy
to make it easier to grok, I hope
2025-01-27 15:34:43 +00:00
Richard van der Hoff
7c57f2cee4 crypto: split out new device collection strategies
Rather than a bunch of flags on `DeviceBasedStrategy`, separate the strategies
properly.
2025-01-27 15:34:43 +00:00
Richard van der Hoff
8d612eca46 crypto: break up split_devices_for_user
handle the separate flags with separate methods.
2025-01-27 15:34:43 +00:00
Richard van der Hoff
98f4d55aa0 test: check serialization format of DeviceBasedStrategy 2025-01-27 15:34:43 +00:00
Richard van der Hoff
709b09c4ec test: factor out test helpers in share_strategy tests
Some helpers for creating common `EncryptionSettings`
2025-01-27 15:34:43 +00:00
Richard van der Hoff
818876a22e crypto: factor out common code between device collection cases
Firstly, build a `CollectRecipientsResult` as we go, rather than building its
components separately and then assembling it at the end.

Then, factor the common code between the two code paths into a method to update
the `CollectRecipientsResult`.
2025-01-27 15:34:43 +00:00
Stefan Ceriu
2657eb7866 feat(ui): expose a method for checking whether a message contains only emojis and should be boosted (use a bigger font size) (#4577)
- supports only text room message types
- enumerates through their body's grapheme clusters and check that every
single one of them is an emoji
- part of the `LazyTimelineItemProvider` so that it can be opt in
2025-01-27 14:00:01 +00:00