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

room names: better make use of the hero names for locally computing a room display name #3461

Merged
merged 11 commits into from
May 27, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented May 24, 2024

This is #3441 but since I've added many commits while taking it over, reopening a new PR for it.

This makes it so that we prefer using the hero names if we receive those from the sliding sync, rather than retrieving the names from the room members that are hero, or retrieving the room members from the first N members.

I've also updated the very unfortunate edge case where we have 0 heroes to display "n people" instead of ", and n others.".

Hywan and others added 9 commits May 23, 2024 19:39
This patch does 3 things:

1. It updates Ruma to the latest revision at the time of writing,
2. It updates `matrix-sdk-ffi` to provide the
   `RoomSubscription::include_heroes` field,
3. It updates `matrix-sdk-base` so that SlidingSync consumes `heroes`
   from the response and update the `RoomSummary` accordingly.

A test has been added to ensure the `RoomSummary` is updated as expected.
Since rendering is sync, and I want the computed display name (which
retrieval is async), I have to fetch the display name early, just after
getting the room. Oh well :)
This is the right goal, and Ruma will be updated to reflect that the
`heroes` field should contain `OwnedUserId` too in [1].

This simplifies the code a bit, and avoids a round-trip encoding
user-ids into a string then decoding them from a string later, in the
case of sliding sync and room name computation.

[1] ruma/ruma#1822
@bnjbvr bnjbvr requested a review from poljar May 24, 2024 10:37
@bnjbvr bnjbvr requested a review from a team as a code owner May 24, 2024 10:37
Copy link

codecov bot commented May 24, 2024

Codecov Report

Attention: Patch coverage is 92.00000% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 83.29%. Comparing base (e9dc02a) to head (adbc78b).
Report is 24 commits behind head on main.

Files Patch % Lines
crates/matrix-sdk-base/src/rooms/normal.rs 86.20% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3461   +/-   ##
=======================================
  Coverage   83.28%   83.29%           
=======================================
  Files         248      248           
  Lines       25198    25220   +22     
=======================================
+ Hits        20987    21007   +20     
- Misses       4211     4213    +2     

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

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are good with these patches. Thanks for digging into this!


let members: StoreResult<Vec<_>> = members.into_iter().collect();
let (heroes, guessed_num_members): (Vec<String>, _) = if !summary.heroes_names.is_empty() {
// Straight-forward path: pass through the heroes names, don't give a guess of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- Straight-forward
+ Straightforward

@Hywan Hywan removed the request for review from poljar May 27, 2024 07:08
Signed-off-by: Benjamin Bouvier <[email protected]>
@bnjbvr bnjbvr enabled auto-merge (rebase) May 27, 2024 08:19
@bnjbvr bnjbvr merged commit 70403b5 into main May 27, 2024
38 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/better-room-summary branch May 27, 2024 08:32
@Hywan
Copy link
Member

Hywan commented Jun 13, 2024

Address part of #3272.

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.

2 participants