-
Notifications
You must be signed in to change notification settings - Fork 739
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
Replaces subtitle in Search Rooms with room context rather than last event #5860
Replaces subtitle in Search Rooms with room context rather than last event #5860
Conversation
childSum.parents.add(SpaceParentSummaryEntity( | ||
canonical = true, | ||
parentRoomId = parent.roomId, | ||
parentSummaryEntity = parent, | ||
viaServers = RealmList() | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BillCarsonFr @bmarty @ganfra can you guys give me more context surrounding this please.
I added this block to add the parents of a room (spaces, etc) as they currently weren't being added, but the canonical = true
and viaServers = RealmList()
are currently placeholders as I don't know what they are or what they should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove this part. Parent is only for m.space.parent state event.
We are not adding a parent link because you are a child.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a child have no knowledge of its parent then, other than through flattenParentIds
? This is confusing because each roomSummary
has the field spaceParents
which is currently often empty.
Ultimately as well, we would like to be able to know a room's parent in its summary object so we can achieve the same as what web does here (the space of the room is displayed in search)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes parent is really when there is a m.space.parent state event in the room (and a valid one, added by an admin in both rooms).
It's not really used right now, it's more to help for discovery, when you join a room from a link the UI could prompt a tip to propose you to join the space.
I think you can use flattenParentsIds for the use case you mentioned.
if (childSum.flattenParentIds?.isEmpty() == false) { | ||
childSum.flattenParentIds += "|" | ||
} | ||
childSum.flattenParentIds += it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes a bug where the first element of flattenParentIds
would always be ""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it a bug? What was not working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g. if a room had one parent, its roomSummary.flattenParentIds
would be {"", "parentRoomId"}
Idk if it has any user-facing impact but I believe this isn't expected behaviour in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am surprised we didn't get report on this, maybe the RoomSummaryMapper is doing some cleaning? None the less I would submit this as a separate PR.
Unit Test Results124 files + 2 124 suites +2 2m 9s ⏱️ -14s Results for commit a5dc8ec. ± Comparison against base commit 4309fdb. This pull request removes 5 and adds 20 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
@@ -26,7 +27,7 @@ class RoomSummaryListController( | |||
|
|||
override fun buildModels(data: List<RoomSummary>?) { | |||
data?.forEach { | |||
add(roomSummaryItemFactory.create(it, emptyMap(), emptySet(), listener)) | |||
add(roomSummaryItemFactory.create(it, emptyMap(), emptySet(), RoomListDisplayMode.ROOMS /* TODO: change */, listener)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx, please see my comments.
) | ||
} | ||
} | ||
roomSummary.copy(spaceParents = parents) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't feel right to copy flattenParents into spaceParents (supposed to be the real m.space.parent)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't wanna do this or the approach done earlier, do we have any way of knowing a room's space parent? (when there isn't a space parent event occurring)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean you could do like that but maybe create a new field in the RoomSummary model like flattenParents
or any name that would mean parent or grand parent, etc.. or childOf
. It's just to reflect that it's the consequence of a m.space.child
relation and not of a m.space.parent
. You could then have a list of RoomSummary and not ParentInfo that needs a viaServer/canonical info.
Other solution could be to get the roomSummary from the flattenParentsIds in the view model.
It could be better to show the last message when nothing else is displayed. Or at least ensure that the room name is centered vertically in this case. |
The current behaviour is in parity with web and desktop's "New Search". Imo it would be better to get into parity with them and if it's not the behaviour we want we can raise a meta issue to fix it across all platforms. This would be a design decision at the end of the day. @niquewoodhouse what do you think? |
I'd rather have parity with web too. I think its rare last message would be helpful in this circumstance, but we should be able to find out in testing and feedback |
…ce-search-room-subheader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just blocking on the way you center text in the item_room.xml.
Happy to discuss this more.
Did not review anything else on this PR.
android:layout_height="15dp" | ||
android:visibility="gone" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/topMarginSpace" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird way to align text vertically. If the font size is changed, it will not work properly.
Is is possible to do better using ConstraintLayout attributes?
Maybe adding a new sublayout if there is no easier solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this with changing consraints programatically, but that affects other bindings as you scroll. There's no easy way to 'reset' the view to its original xml state.
Can you explain more what you mean by sublayout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sublayout: add a new ConstraintLayout to pack the Title and the Subtitle.
I did not check if this is possible, there are other views around.
I will try to play a bit on this layout to see if I find something better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the best way to do this imo is to inflate an entirely different Epoxy item based on whether there is a subtitle or not. What are your thoughts on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will improve that in the future, there is another bug related, with the placeholder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I am removing myself from the reviewer now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Did not make a full review)
@@ -193,7 +194,7 @@ internal class RoomSummaryDataSource @Inject constructor( | |||
} | |||
val dataSourceFactory = realmDataSourceFactory.map { | |||
roomSummaryMapper.map(it) | |||
} | |||
}.map { it.getWithParents() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be cool to have an overload of map
in RoomSummaryMapper
to have a param to request flattened parent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better also. Like that it won't impact perf for those who don't need to load additional things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good shout!
private fun RoomSummary.getWithParents(): RoomSummary { | ||
val parents = flattenParentIds.mapNotNull { parentId -> | ||
getRoomSummary(parentId)?.let { parentSummary -> | ||
SpaceParentInfo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just return the RoomSummaries here instead of fake parentInfo with fake/wrong canonical & viaservers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk why I didn't do this to start with lmao
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Matrix SDKIntegration Tests Results:
|
Drafting for early discussion purposes
Assignees assigned for taking a look at my query below, didn't want to overfill the reviewers section
Type of change
Content
Instead of showing the last event (last message sent, etc.), room list items in the search screen will show room context (parent space, user id, canonical alias, etc)
Motivation and context
Closes #3943
This brings Android into parity with desktop clients.
Getting the space that the room belonged to was not as straightforward as initially expected. Spaces that rooms belonged to often weren't being saved properly into Realm which meant that rooms that belonged to spaces had an empty list of parents. This is why this PR contains updates to
RoomSummaryUpdater
and related classesOther changes in this PR include: Centering of the room title when the subtitle is empty
I also took this opportunity to cleanup some commented code
Screenshots / GIFs
As you can see above, for space rooms, we show the space or subspace they belong to. For non-space rooms, we show their alias if its available. For dms, we show the user id of the other recipient. Otherwise, we show nothing
Tests
Tested devices
Checklist