refactor: Make SpaceRoom compute is_dm on demand#6561
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6561 +/- ##
==========================================
- Coverage 89.93% 89.89% -0.04%
==========================================
Files 381 381
Lines 106865 106886 +21
Branches 106865 106886 +21
==========================================
- Hits 96112 96090 -22
- Misses 7101 7132 +31
- Partials 3652 3664 +12 ☔ View full report in Codecov by Sentry. |
stefanceriu
reviewed
May 11, 2026
| } | ||
| } | ||
|
|
||
| async fn children_rooms(client: &Client, children: &[OwnedRoomId], graph: &SpaceGraph) -> Vec<SpaceRoom> { |
Member
There was a problem hiding this comment.
Should we call this children_space_rooms to make things just a bit clearer? Or maybe use children_ids, or both?
Contributor
Author
|
I think I handled all the feedback in 48740d1, let me know if something's missing. |
stefanceriu
approved these changes
May 11, 2026
stefanceriu
left a comment
Member
There was a problem hiding this comment.
The test are not happy, but I am, 🐑🚀 it!
27aba4f to
7b2913c
Compare
Contributor
Author
|
Many thanks to @frebib for his help while testing this, including a corner case I completely missed 🙏 . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This means making both
SpaceRoom::new_from_summaryandSpaceRoom::new_from_known_roomasync, which in turn forces us to change how we instantiate those in quite a few places.Why do we need this? It seems like the pre-computed
active_service_member_countis not usually available for these rooms: if you are in spaces with lots of rooms you haven't visited before, you wouldn't have triggered theirsync_memberscall that would compute this value. In those cases, you'd get the wrong computed room display names andis_dmvalues.Also, I tweaked a bit how the display name computation and the
heroesvalues are returned:compute_display_name_from_heroestheif num_heroes < num_joined_invited_except_self && num_joined_invited > 1line would always be triggered for rooms with service members.heroesfield inSpaceRoom, useRoom::heroesinstead ofRoomInfo::heroes. The latter just stores what the HS returns, while the former filters out service members that should not be considered heroes.Changes after review: the
SpaceRoomList::roomsMutex is now anAsyncMutex. This changes some other method signatures so they're async now too.CHANGELOG.mdfiles.Signed-off-by: