Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): Client-side sorting in RoomList #3585

Merged
merged 19 commits into from
Jul 3, 2024

Commits on Jun 30, 2024

  1. chore(cargo): Update eyeball-im and eyeball-im-util.

    The idea is to get the `SortBy` stream adapter.
    Hywan committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    73b481a View commit details
    Browse the repository at this point in the history
  2. feat(ui): RoomList::entries* manipulates a Room.

    This patch is quite big… `RoomList::entries*` now returns `Room`s
    instead of `RoomListEntry`s. This patch consequently updates all the
    filters to manipulate `Room` instead of `RoomListEntry`. No more
    `Client` is needed in the filters.
    
    This patch also disables the `RoomList` integration test suite in order
    to keep this patch “small”.
    Hywan committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    1270cda View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2024

  1. feat(ui): Remove visible_rooms from RoomListService.

    This patch removes the `visible_rooms` sliding sync list from
    `RoomListService`. As we are taking the path of doing client-side
    sorting, the ordering of the server-side will most likely always
    mismatch the ordering of the client-side, thus using `visible_rooms`
    with room indices make no sense (indices from server-side won't map
    indices on the client-side, so room ranges from client-side won't map
    what the server knows).
    
    We used to use `visible_rooms` to “preload” the timeline of rooms in
    the user app viewport, with a `timeline_limit` of 20. This should be
    replaced by room subscriptions starting from now. For the moment, the
    user of `RoomListService` is responsible to do that manually. Maybe
    `RoomListService` will handle that automatically in the future.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    7aa7d1c View commit details
    Browse the repository at this point in the history
  2. feat(base): Add LatestEvent::cached_event_origin_server_ts.

    This patch adds a new `cached_event_origin_server_ts` field on
    `LatestEvent`, which is a copy of the `origin_server_ts` of the inner
    `SyncTimelineEvent`.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    daf878f View commit details
    Browse the repository at this point in the history
  3. feat(ui): Add the recency, name and or sorters for the RoomList.

    This patch adds 3 sorters for the `RoomList`: `recency`, `name` and
    `or`.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    ec80c6f View commit details
    Browse the repository at this point in the history
  4. feat(ui): The RoomList uses sorters!

    This patch “installs” the sorters API for the `RoomList`.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    ff4af89 View commit details
    Browse the repository at this point in the history
  5. feat(ui) Rename RoomList' sorter or to lexicographic.

    This patch renames the `or` sorter to `lexicographic` as it describes
    better what it does.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    51ca5a7 View commit details
    Browse the repository at this point in the history
  6. test(ui): Update tests of the RoomList with sorters.

    This patch mostly tests that sorting the rooms in the room list by
    recency and by name works as expected.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    ed086af View commit details
    Browse the repository at this point in the history
  7. feat(ffi) Update RoomList API to the recent changes.

    This patch adapts the `RoomList` FFI API to the recent changes to
    suport a `Stream<Item = RoomListItem>` instead of a `Stream<Item =
    RoomListEntry>`. Behind the scene, it supports client side sorting for
    the rooms but this is transparent for this API.
    
    This patch also removes the `RoomListInput` enum as no input is
    supporter anymore.
    
    The `entries` method no long returns a `RoomListEntriesResult` but
    directly a `TaskHandle`. The given listener will receive the initial
    entries as a `VectorDiff::Append`, which first is simpler but also fixe
    a potential race condition bug.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    606a151 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    2c25103 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    7647728 View commit details
    Browse the repository at this point in the history
  10. test: Disable Complement.

    Complement uses the FFI `RoomList` API. Since the patch set modifies
    this API, Complement is broken. We disable it and will re-enable it once
    we have updated Complement.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    ab190ad View commit details
    Browse the repository at this point in the history
  11. fix(ui): merge_stream_and_receiver gives priority to raw_stream.

    This patch rewrites `merge_stream_and_receiver` to switch the order
    of `roominfo_update_recv` and `raw_stream`. The idea is to give the
    priority to `raw_stream` since it will necessarily trigger the room
    items recomputation.
    
    This patch also remove the `for` loop with `Iterator::enumerate`, to
    simply use `Iterator::position`: it's more compact and it removes a
    `break` (it makes the code simpler to understand).
    
    Finally, this patch renames `merged_stream` into `merged_streams`.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    b525002 View commit details
    Browse the repository at this point in the history
  12. chore(ui): Remove the RoomListService::rooms cache.

    This patch removes the `RoomListService::rooms` cache, since now a
    `Room` is pretty cheap to build.
    
    This cache was also used to keep the `Timeline` alive, but it's now
    recommended that the consumer of the `Room` keeps its own clone of the
    `Timeline` somewhere. We may introduce a cache inside `RoomListService`
    for the `Timeline` later.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    5d68f89 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    813ce6a View commit details
    Browse the repository at this point in the history
  14. !fixup Remove useless comment.

    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    765b954 View commit details
    Browse the repository at this point in the history
  15. feat(base): Store the timestamp from SS in `RoomInfo::recency_times…

    …tamp`.
    
    This patch adds a new field in `RoomInfo`: `recency_timestamp:
    Option<MilliSecondsSinceUnixEpoch>>`. Its value comes from a Sliding
    Sync Room response, that's why all this API is behind `cfg(feature =
    "experimental-sliding-sync")`.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    9a02d68 View commit details
    Browse the repository at this point in the history
  16. feat(ui): The recency sorter now uses recency_timestamp.

    This patch changes the `recency` sorter to use `Room::recency_timestamp`
    instead of `LatestEvent::event_origin_server_ts` to sort rooms.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    b4bbb10 View commit details
    Browse the repository at this point in the history
  17. chore(base): Remove LatestEvent::cached_event_origin_ts.

    This patch removes the `LatestEvent::cached_event_origin_ts`.
    It's no longer necessary to cache this value as the
    `matrix_sdk_ui::room_list_service::sorter::recency` sorter no longer
    uses it.
    Hywan committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    3588b88 View commit details
    Browse the repository at this point in the history