Handle all room info changes in the room list service stream#607
Merged
kevinaboos merged 8 commits intoOct 22, 2025
Merged
Conversation
Ensure that we use the `RoomTombstoneEventContent` to infallibly inform the RoomScreen UI widget that a given room has been tombstoned and that its successor room is now known. Closes project-robius#606
Instead of checking the latest event's content to catch changes, (which is fallible as it may miss certain events), we now handle it entirely in the stream of changes that comes from the RoomListService. I still feel like there must be a better way to do this, since we ideally wouldn't need to maintain virtually the entire state of the room in a separate cached struct (see `RoomListServiceRoomInfo`), but I currently cannot see any other means of doing so. We also still have to check for an update to the latest event ON EVERY CHANGE to the room, which seems wildly inefficient. We can't even use the `new_latest_event_timestamp()` to check if the latest event actually has been updated more recently than others. One reason for this is that certain events, like redactions, seem to not update the timestamp, so if we don't blindly update the latest event upon every room change, then redactions are skipped (incorrectly). However, we have still improved the handling of lots of other room info kinds, e.g., tags, unreads, room display name & avatar, tombstoned state, `is_direct` state, power levels, etc.
…e functions This avoids duplicate code in `update_room()` and is also much more efficient when re-using room info that we have already obtained up front (right after discovering a new room from the room_list_service stream)
Member
Author
|
Reviewed, tested, and ready to merge 🚀 |
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.
Instead of checking the latest event's content to catch changes, which is fallible as it may miss certain events, we now handle it entirely in the stream of changes that comes from the RoomListService.
Side note: I still feel like there must be a better way to do this, since we ideally wouldn't need to maintain virtually the entire state of the room in a separate cached struct (see
RoomListServiceRoomInfo), but I currently cannot see any other means of doing so.We also still have to check for an update to the latest event ON EVERY CHANGE to the room, which seems wildly inefficient. We can't even use the
new_latest_event_timestamp()to check if the latest event actually has been updated more recently than others.One reason for this is that certain events, like redactions, seem to not trigger a change to the room, or they don't update the timestamp of the latest event API, so if we don't blindly update the latest event upon every room change, then redactions are skipped, which means the deleted message content is still shown incorrectly.
However, we have still improved the handling of lots of other room info kinds, e.g., tags, unreads, room display name & avatar, tombstoned state,
is_directstate, power levels, etc.Ensure that we use the
RoomTombstoneEventContentto infallibly inform the RoomScreen UI widget that a given room has been tombstoned and that its successor room is now known.TODO before merging: create thedone ✅RoomListServiceRoomInfofor the new room before callingupdate_room(), and pass a reference to that intoupdate_room()as thenew_room. That will avoid the duplicate code inRoomListServiceRoomInfo::from_room()and in this range of code:https://github.com/kevinaboos/robrix/blob/475cfed1b6cbc03f969040d11b24ef2074d5be5e/src/sliding_sync.rs#L2189-L2273
Closes #606.
Closes #586.