-
Notifications
You must be signed in to change notification settings - Fork 295
fix(base,sdk,ui): Synchronize sliding sync room's avatar with regular Room
#3078
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
fix(base,sdk,ui): Synchronize sliding sync room's avatar with regular Room
#3078
Conversation
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'm pretty sure this reintroduces the bug tested by test_avatar_set_then_unset
, which has been removed. We need to be able to unset an avatar when the received room avatar is set to null.
Can you reintroduce a similar test, please? (See commit and accompanying issue to understand what it fixed.)
56d7f38
to
675ea14
Compare
@bnjbvr You're right. I've updated the test suite, and added the handling of |
675ea14
to
7f63fc0
Compare
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! Small suggestion below, shouldn't require another review.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3078 +/- ##
==========================================
+ Coverage 83.72% 83.75% +0.03%
==========================================
Files 224 224
Lines 23514 23521 +7
==========================================
+ Hits 19688 19701 +13
+ Misses 3826 3820 -6 ☔ View full report in Codecov by Sentry. |
To update the avatar of a room, one has to look up in the state event. That's the canonical way to do. For Sliding Sync, it means looking inside the `required_state` field of the `v4::SlidingSyncRoom`. This case already works and was tested. However, a `v4::SlidingSyncRoom` comes with a direct `avatar` field. It's another way to know the avatar URL of the room. This case was handled and tested in `matrix_sdk::sliding_sync::SlidingSyncRoom`, but it was never propagated into the proper sync mechanism. So when the `avatar` field was set up, `matrix_sdk::sliding_sync::SlidingSyncRoom` was holding this information, and the `avatar` wasn't defined in the proper `Room`: `SlidingSyncRoom` has to look up inside the `Room` as a fallback. This patch is the first one to fix this “fallback” mechanism. The `avatar` field of a `v4::SlidingSyncRoom` now triggers an update to the new `RoomInfo::update_avatar` method (à la `update_name`), via `process_room_properties`.
With the previous commit, the avatar is properly synchronized with the `Room`. The result is that `SlidingSyncRoom` no longer needs to hold the `avatar_url`.
…ice::Room`. `SlidingSyncRoom` no longer has an `avatar_url` method. `room_list::Room` no longer needs to check first in sliding sync then in `Room` as a fallback. This patch removes the `room_list::Room::avatar_url` method. This patch also implements `Deref` for `room_list::Room` to `matrix_sdk::Room`, to make our lifes easier.
7f63fc0
to
9ef9251
Compare
This PR must be reviewed commit by commit.
To update the avatar of a room, one has to look up in the state event.
That's the canonical way to do. For Sliding Sync, it means looking
inside the
required_state
field of thev4::SlidingSyncRoom
. Thiscase already works and was tested.
However, a
v4::SlidingSyncRoom
comes with a directavatar
field.It's another way to know the avatar URL of the room. This case was
handled and tested in
matrix_sdk::sliding_sync::SlidingSyncRoom
, butit was never propagated into the proper sync mechanism. So when the
avatar
field was set up,matrix_sdk::sliding_sync::SlidingSyncRoom
was holding this information, and the
avatar
wasn't defined in theproper
Room
:SlidingSyncRoom
has to look up inside theRoom
asa fallback.
This fallback mechanism was present in
matrix_sdk::sliding_sync::SlidingSyncRoom
, but also inmatrix_sdk_ui::room_list::Room
.These patches fix this “fallback” mechanism.
It's the first patch of a series to remove tech debt about sliding sync room.
SlidingSyncRoom
tech debt #3079