fix(room): make the room previews more reliable #4325
Merged
+57
−23
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 should help make room previews more reliable:
Room::history_visibility
was to always return anHistoryVisibility
value, even when the event is missing. In case it was missing, it would returnWorldReadable
, which is against the spec, which states that it should beShared
, in that case.test_room_preview
intermittently fails #3483 (comment), them.room.create
andm.room.history_visibility
MUST be present to correctly calculate theroom_type
andis_world_readable
fields from aRoomPreview
.Solution for 1 consists in splitting the method into two: one that returns an
Option<HistoryVisibility>
, and another that returns the better sensible default as specified by the spec.Solution for 2 consists in adding those two events to the required_state list for the room list service. For sync v2, we're getting all the events anyways, so we should handle them correctly.
Fixes #3483.