-
Notifications
You must be signed in to change notification settings - Fork 239
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
sdk: Allow to track ambiguity changes per-room #3062
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.
Thanks for the PR. I like it. I particularly appreciate the tests!
I've a few feedback, but overall it's a good patch.
|
||
let mut state = self.state.write().await; | ||
let mut entries = state.items.entries(); | ||
while let Some(mut entry) = entries.next() { |
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:
for mut entry in entries { … }
?
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.
ObservableVectorEntries
does not implement Iterator
/IntoIterator
, it just has a .next()
method.
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.
@jplatte Any reason why ObservableVectorEntries
doesn't implement an Iterator
?
Makes AmbiguityChange easier to use, especially outside of SyncResponse, where we might not have the m.room.member event. Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
5eaf3a6
to
3599e57
Compare
Rebased on main for the CI fix |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3062 +/- ##
==========================================
- Coverage 83.73% 83.70% -0.04%
==========================================
Files 224 223 -1
Lines 23497 23408 -89
==========================================
- Hits 19675 19593 -82
+ Misses 3822 3815 -7 ☔ View full report in Codecov by Sentry. |
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.
All good to me. Please update the CHANGELOG
and we are good :-).
crates/matrix-sdk/CHANGELOG.md
Outdated
@@ -5,6 +5,8 @@ Breaking changes: | |||
- Replace the `Notification` type from Ruma in `SyncResponse` and `Client::register_notification_handler` | |||
by a custom one | |||
- `Room::can_user_redact` and `Member::can_redact` are split between `*_redact_own` and `*_redact_other` | |||
- `RoomUpdate` also contains the ambiguity changes of a `Room` with `AmbiguityCache` containing the |
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 reckon this might be updated since ambiguity_changes
are part of LeftJoin
, JoinedRoom
and InvitedRoom
right?
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, I updated the changelog.
Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
I merged main into the branch to solve a conflict. That makes the ambiguity changes go through the event graph untouched, so I am not sure it's the best solution. |
Let's consider it's fine for the moment. |
This PR had the main goal to allow to follow ambiguity changes per-room, without relying on the
SyncResponse
. We need this because we keep the members list of the current room in memory for mention autocompletion in Fractal.As a bonus, we use that to update profiles in the
Timeline
when there is an ambiguity change (ticks one of the boxes in #1103).