Commit Graph

8590 Commits

Author SHA1 Message Date
Benjamin Bouvier
b78bbc01a0 timeline: pin all the local echoes to the bottom
Before this patch, only local echoes that were messages not sent or
messages succesfully sent (but not ack'd yet by sync) would be pinned to
the bottom.

This fixes it by also pinning events that failed to send.

Fixes #3287.
2024-04-04 15:02:13 +02:00
Stefan Ceriu
682c17c9d8 feat: add support for storing breacrumbs in the state store 2024-04-04 11:23:55 +02:00
Damir Jelić
4da1c01963 chore: Fix some typos 2024-04-04 11:17:18 +02:00
Benjamin Bouvier
96a4b06ca6 timeline: use the day divider adjuster when updating the send state of a message 2024-04-02 16:16:45 +02:00
Benjamin Bouvier
ef5b12035d day dividers: explicitly chase trailing day dividers
The algorithm works on the basis that we remove a previous day divider
if it was spurious. But we'd never do this, for a final item that would
be a day divider! So chase these explicitly, also ignore read markers
that would be in the way.
2024-04-02 16:16:45 +02:00
Kévin Commaille
38978dacd7 crypto: Define both bounds in the same place
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 15:05:41 +02:00
Kévin Commaille
74ea661438 chore: Use only extern attributes for test modules
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 15:05:41 +02:00
Kévin Commaille
da2abccc0d chore: Disable clippy::assigning_clones lint
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 15:05:41 +02:00
Benjamin Bouvier
6731c52b12 base: extract changes to profile into a small function helper
and detail the comment about why we need to remove a previous profile
first.
2024-04-02 14:30:19 +02:00
Benjamin Bouvier
a3ca28f1a5 test: add regression test for #3278 2024-04-02 14:30:19 +02:00
Benjamin Bouvier
450ceaa241 base: remove previous profiles of member when they're invited 2024-04-02 14:30:19 +02:00
Benjamin Bouvier
6cd655ba7c state store: add Changes::profile_to_delete field
So as to remove existing profiles from the storage.
2024-04-02 14:30:19 +02:00
Kévin Commaille
f9ab073adf chore: Avoid redundant imports
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 13:27:58 +02:00
Kévin Commaille
b5d7c40029 tests: Use .contains_key() instead of .get().is_some()/.is_none()
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 13:27:58 +02:00
Stefan Ceriu
29f7f88a2c ffi: expose room and event matrix.to permalink builder methods 2024-04-02 10:35:23 +02:00
Benjamin Bouvier
db37a1feb5 base: fix typo in comment 2024-03-29 13:04:39 +01:00
Benjamin Bouvier
901024bccc base: remove cognitive overload when passing parameters
The `MemberInfo` struct only existed to regroup parameters, so let's
pass individual parameters instead. One less data structure is good for
the cognitive load.
2024-03-29 13:04:39 +01:00
Benjamin Bouvier
5d1fa986f3 base(logs): remove spammy trace statements in BaseRoom::get_member
and in BaseRoom::member_room_info.
2024-03-29 13:04:39 +01:00
Benjamin Bouvier
aa99c7bd38 base(style): avoid repetitions of and_then
Option::and_then(f).and_then(g) is equivalent to Option::and_then(g(f?)).
2024-03-29 13:04:39 +01:00
Benjamin Bouvier
76d484541f test: add test for #3278 2024-03-29 13:04:39 +01:00
Benjamin Bouvier
8482d181b5 base: ensure test_ prefix for all the tests 2024-03-29 13:04:39 +01:00
Benjamin Bouvier
650f210da7 base: copy comment in receive_all_members explaining why it's not fine to set the profile of another user 2024-03-29 11:56:29 +01:00
Benjamin Bouvier
191350a290 Revert "fix: Process profiles for all room members not only state event senders (#3278)"
This reverts commit 99e47ed5d7.
2024-03-29 11:56:29 +01:00
Ivan Enderlin
95baf17c36 fix(sdk): Fix LinkedChunk::insert_items_at.
This patch fixes a bug when inserting items at the end of the
current items of a chunk. The condition was: `if item_index >=
current_items_length`, which is too restrictive. The bug was “hidden”
so far because it's not possible to get the position of “after an item”
with the current API. However, the bug arises if the items are empty and
new items are inserted the position index 0 (index = 0, length = 0).

The fix consists of relaxing the condition, and introducing an
optimisation. If we insert at the end, we do a simple push (like an
append). If we insert at another position, we split, then push the new
items, and finally push the detached items (as it was the case before).

The tests have been updated accordingly.
2024-03-29 11:43:25 +01:00
Benjamin Bouvier
1c1053afe6 event cache: internalize handling of the account data
(By moving handling of the fully read marker into the event cache
itself.)
2024-03-28 17:59:43 +01:00
Andy Balaam
7ac153fd67 Merge pull request #3282 from matrix-org/andybalaam/memorystore-tracked-users-map
memorystore: Fix bug where duplicate tracked users are stored
2024-03-28 16:33:49 +00:00
Andy Balaam
31131146a6 memorystore: Fix bug where duplicate tracked users are stored 2024-03-28 16:19:23 +00:00
Ivan Enderlin
ac0bc95c25 feat(sdk): EventCache fully uses RoomEvents/LinkedChunk
feat(sdk): `EventCache` fully uses `RoomEvents`/`LinkedChunk`
2024-03-27 10:23:42 +01:00
Ivan Enderlin
11c3799fa2 doc(sdk): Improve doc of EventCache. 2024-03-27 09:39:22 +01:00
Ivan Enderlin
f11cf87326 fix(sdk): Replace unwrap by expect and add SAFETY docs. 2024-03-27 09:35:45 +01:00
Ivan Enderlin
7b092fd174 doc(sdk): Improve documentation of EventCacheInner::multiple_room_updates_lock. 2024-03-27 09:32:33 +01:00
Ivan Enderlin
1fa4bb4cfa chore(sdk): Remove commented code. 2024-03-27 09:32:33 +01:00
Ivan Enderlin
dabc7c512c !revert test changes 2024-03-27 09:32:33 +01:00
Ivan Enderlin
8fe27ab582 doc(sdk): Improve documentation of RoomEvents::replace_gap_at. 2024-03-27 09:32:33 +01:00
Ivan Enderlin
8c1d3f4f60 feat(sdk): RoomEventCacheInner::backpaginate always return Ok for unknown token.
Prior to this patch, in `RoomEventCacheInner::backpaginate`, when the
`token` validity was checked, and it was invalid:

* before calling `/messages`, `Err(EventCacheError::UnknownBackpaginationToken)` was returned,
* after calling `/messages`, `Ok(BackPaginationOutput::UnknownBackpaginationToken)` was returned.

This patch tries to uniformize this by only returning
`Ok(BackPaginationOutput::UnknownBackpaginationToken)`.

That's a tradeoff. It will probably be refactor later.

The idea is also to call `/messages` **before** taking the write-lock
of `RoomEvents`, otherwise it can keep the lock for up to 30secs in
this case. Also, checking the validity of the `token` **before** and
**after** `/messages` is not necessary: it can be done only after.
2024-03-27 09:32:33 +01:00
Ivan Enderlin
a623215257 chore(sdk): Make Clippy happy. 2024-03-27 09:32:33 +01:00
Ivan Enderlin
f61de718b8 fix(sdk): Fix a race-condition in EventCache.
This patch ensures that operations on `RoomEvents` happen in one block,
by sharing the same lock.

2 new methods are created: `replace_all_events_by` and
`append_new_events`.
2024-03-27 09:32:33 +01:00
Ivan Enderlin
fa5bbadf57 doc(sdk): Just highlight how important this lock is. 2024-03-27 09:32:15 +01:00
Ivan Enderlin
9319f4fcff test(sdk): Fix test_reset_while_backpaginating.
The test `test_reset_while_backpaginating` was expecting a
race-condition, which no longer exists. It first initially tried to
assert a workaround about this race-condition. It doesn't hold anymore.
Rewrite the test to assert the (correct) new behaviour.
2024-03-27 09:32:15 +01:00
Ivan Enderlin
25fb9ee47d feat(sdk): Update RoomEvents::replace_gap_at to return a &Chunk. 2024-03-27 09:32:15 +01:00
Ivan Enderlin
85538dc3ed feat(sdk): Remove EventCacheStore, TimelineEntry, RoomInfo and MemoryStore. 2024-03-27 09:23:51 +01:00
Ivan Enderlin
5bb2511914 test(sdk): Tests of EventCache uses RoomEvents. 2024-03-27 09:23:25 +01:00
Ivan Enderlin
667ada88e6 feat(sdk): RoomEventCache::subscribe uses RoomEvents. 2024-03-27 09:23:05 +01:00
Ivan Enderlin
022b8a0f38 feat(sdk): EventCache::listen_task uses RoomEvents. 2024-03-27 09:22:43 +01:00
Ivan Enderlin
29caa02ef0 feat(sdk): EventCache::add_initial_events uses RoomEvents. 2024-03-27 09:22:13 +01:00
Ivan Enderlin
9102a9c841 feat(sdk): RoomEventCachecacherInner::oldest_backpagination_token uses RoomEvents. 2024-03-27 09:21:05 +01:00
Stefan Ceriu
99e47ed5d7 fix: Process profiles for all room members not only state event senders (#3278) 2024-03-27 09:13:18 +01:00
Ivan Enderlin
54729ce32b feat(sdk): Start disabling the global store in EventCache. 2024-03-27 09:11:15 +01:00
Ivan Enderlin
36e199c31e feat(sdk): Implement RoomEvents::reset, push_gap, replace_gap_at and events.
This patch implements the following wrapper methods (over
`LinkedChunk`): `push_gap`, `replace_gap_at` and `events`. This patch
also implements the `reset` method that clears/drops all chunks in the
`LinkedChunk`.
2024-03-27 09:07:52 +01:00
Richard van der Hoff
ab9e4f73b1 crypto: Add OlmMachine::device_creation_time (#3275)
Turns out this is useful for https://github.com/element-hq/element-meta/issues/2313.
2024-03-26 15:13:55 +00:00