-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
boxes: Use user_id
s in autocomplete for user mentions.
#928
Conversation
9ab0e5b
to
2bb5bae
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.
@prah23 This seems to work, but while you mentioned adding tests later on czo, you note in the commit text that tests are included - did you forget to add them?
Manually this seems to work, but once we have tests then we could ensure we exercise the code a little more. The duplicates check relies on adjacent elements being identical given the sort?
@neiljp I haven't removed the " The duplicates list is formed by checking if the current name in the loop exists in the sub-list of elements leading to the current name. I've run this loop on the |
Re adjacency, I was referring to the sub-list check you indicated. If the list is sorted, can we rely upon the previous entry only? Alternatively, it might be clearer to use Counter. In any case, once we have tests then this will be easier to explore. |
2bb5bae
to
8d61607
Compare
11ca5a4
to
c41ed97
Compare
ERROR: Label "PR needs review" does not exist and was thus not removed from this pull request. |
@zulipbot add "PR needs review" |
@zulipbot remove "PR awaiting update" |
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.
@prah23 This seems close to being merged 👍
4b7371b
to
7172b8f
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.
@neiljp I've addressed all your comments from the previous review. I haven't combined the tests due to the typeahead list being different (normal and silent mentions) and I've also had to explicitly add a test case, which I've explained inline. It's ready for a review.
tests/ui_tools/test_boxes.py
Outdated
@pytest.mark.parametrize('text', [ | ||
prefix + 'Human'[:index + 1] for index in range(len('Human')) | ||
for prefix in ['@', '@**'] | ||
] + ['@**']) |
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 having to add this prefix as an extra case this way because it moves away from the general pattern that is common for both prefixes. We're able to test only the prefix as a case in case of @**
and not @
is because the only the former is specifically used only for user mentions and has only user names in the typeahead, the latter also being applicable to group names.
7172b8f
to
85abbf6
Compare
This commit adds two new users to the testing suite, both named 'Human Duplicate' as a prep commit for future tests that need such users. Tests updated (by adding test cases where relevant and extending existing parameters to include both these users in typeaheads and footer texts).
85abbf6
to
7a9cb8f
Compare
@neiljp this has been |
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.
@prah23 As discussed this looks close to merging and really clean 👍
I just left a few comments inline.
7a9cb8f
to
1d87807
Compare
1d87807
to
aede198
Compare
Prior to this commit, user mentions through autocomplete used only names in the typeahead. This commit appends `user_id`s to all the multiple instances of the same name to use the **Name|User_id** format of user mentions. This is done by using collections.Counter to check the count of each user name in the users list. The user_id is appended to names that have a count greater than 1. The appended user_id would serve as a distinction between users having the same name. Tests added and updated. Fixes zulip#151.
aede198
to
ecbbc64
Compare
@prah23 Thanks for working on this - I'm going to merge this now 🎉 We could debate the best test structure, but having the feature there and tested is good and we can always iterate from there 👍 |
This PR adds a commit that append
user_id
s to the users' names in the autocomplete typeahead for user mentions. This helps in distinguishing between users having the same name, similar to the pm recipients autocomplete.Tests updated.
Fixes #151.