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(room_preview): Use room directory as another data source #4272

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jmartinesp
Copy link
Contributor

For getting a RoomPreview we have the following paths, unfolding from Client::get_room_preview.

  • If the room is known, get the preview from its RoomInfo.
  • If it's not known:
    • Try using MSC3266 to get a preview.
    • If MSC3266 is not enabled, try asking your homeserver for some state and room member data.

The 'not known' part may fail oftentimes if the MSC is not enabled, so we're trying to complement it with the room directory search for public rooms, which will be added as another possible fallback.

The way this works is:

  • If we have a room alias, use it for the search, take the first 20 results and look for a room with the expected room id.
  • If we don't have it, request 100 rooms and try to find a matching room as a best effort (this may work for small HS, but definitely not for large ones).

In case we have several via parameters, we'll start a search in each of them and stop as soon as one of them returns valid results.

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@jmartinesp jmartinesp requested a review from a team as a code owner November 15, 2024 14:58
@jmartinesp jmartinesp requested review from bnjbvr and removed request for a team November 15, 2024 14:58
@jmartinesp jmartinesp force-pushed the feat/room-preview-use-room-directory-search branch from 60fc4b5 to 95083a9 Compare November 15, 2024 15:01
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 73.01587% with 17 lines in your changes missing coverage. Please review.

Project coverage is 84.98%. Comparing base (232391c) to head (95083a9).

Files with missing lines Patch % Lines
crates/matrix-sdk/src/test_utils/mocks.rs 59.25% 11 Missing ⚠️
crates/matrix-sdk/src/room_preview.rs 83.33% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4272      +/-   ##
==========================================
- Coverage   85.00%   84.98%   -0.02%     
==========================================
  Files         274      274              
  Lines       29952    30013      +61     
==========================================
+ Hits        25460    25508      +48     
- Misses       4492     4505      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant