-
Notifications
You must be signed in to change notification settings - Fork 336
Verify membership when test if name is ambiguous #5780
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
base: main
Are you sure you want to change the base?
Verify membership when test if name is ambiguous #5780
Conversation
|
It's pretty straightforward but should I had some tests? |
b1cd305 to
47488fd
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5780 +/- ##
=======================================
Coverage 88.45% 88.46%
=======================================
Files 360 360
Lines 100322 100400 +78
Branches 100322 100400 +78
=======================================
+ Hits 88737 88816 +79
+ Misses 7420 7417 -3
- Partials 4165 4167 +2 ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #5780 will not alter performanceComparing Summary
|
| .is_some_and(|s| is_display_name_ambiguous(&display_name, s)); | ||
| let membership = event.membership(); | ||
| let display_name_ambiguous = users_display_names.get(&display_name).is_some_and(|s| { | ||
| is_display_name_ambiguous(&display_name, s) && *membership != MembershipState::Leave |
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.
So we don't want to disambiguate the name of a left user, why is that? I see the AmbiguityCache has a concept of active members so what are we trying to achieve here?
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's because of the spec. It only sees member with an join or an invite membership as needing disambiguation
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 updated the code to follow more precisely the spec.
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 patch! Can you add a test please? Ideally it would show the case that's failing on main (but supposed to work), and that would be working with your patch now.
| is_display_name_ambiguous(&display_name, s) | ||
| && (*membership == MembershipState::Join || *membership == MembershipState::Invite) |
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.
Can you write the second part with a match statement, please? This will make it so that we explicitly handle all the membership cases, and we don't forget to think about handling it, would we have a new membership kind later on.
if !is_display_name_ambiguous(&display_name, s) {
return false;
}
match *membership {
// handle all variants explicitly here
}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.
Ok I will
6314fbb to
7a93c57
Compare
|
@bnjbvr matrix-rust-sdk/crates/matrix-sdk-base/src/room/members.rs Lines 615 to 622 in 7a93c57
Unless I misunderstood, the name should be here ambiguous and the test should on line 621 should not be failing. Should I make a new issue ? |
|
It sounds like the code you've changed introduced a regression, so, no, we can't merge this as is and open a new issue. Instead, one should investigate the issue and attempt to fix it :) |
|
So i checked, and it seems that when using saving_changes to store the member events in MemoryStore, the HashMap |
|
@bnjbvr |
|
I made a mistake anyway, I should check the membership of every RoomMember with the same displayname, I'm getting back into IT. |
b932ac2 to
1f759a6
Compare
52fad95 to
2892f60
Compare
Verify if the membership is not Leave when checking if a name in a room is ambiguous.
Signed-off-by:
multi
Fix #5774