-
-
Notifications
You must be signed in to change notification settings - Fork 781
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
[autocomplete] prioritize the user for which the nickname STARTS with the text typed #2231
Comments
@Zash noted that the autocomplete behavior can be controlled with the However, it would be preferable to prioritize nicknames that start with the provided input, when the |
By analyzing the code, here are the different filters available: converse.js/src/converse-autocomplete.js Lines 15 to 22 in 522e770
What do you think of a solution that adds a third filter, "starts_or_contains" ? |
I do not think that's the right approach. Instead, I think you should modify the order of results that are returned with |
The You'll need to update |
The sort function only takes two parameters, the current and the next element, but I'm supposed to reorganize the results according to the text typed by the user. An idea on how I can have the text typed in a sort function without changing the signature of the function so that it remains compatible ? |
The things being compared here are instances of the Suggestion class. That class already has a I've made a change to do that here: a72ad8a So now you have the text typed by the user as the |
Here is what I’ve done #2234, it works as expected on my machine but it seems to break some unit tests, how can I fix that ? |
You'll have to identify the failing tests and then run them individually to figure out why they're failing and then fix the tests or the underlying issue in the code. I've written some documentation on how to run the tests: https://github.com/conversejs/converse.js/blob/master/docs/source/testing.rst |
tell me if I'm wrong, the auto-completion for contacts uses the "contains" filter but it looks like the results are not sorted, Lines 541 to 557 in fff9eea
Tybalt, comes before Balthasar. how do I activate the filter, when it comes to contacts? |
Can you please rephrase your question? We've disucced it in the chatroom, but couldn't understand what you're trying to say. |
@bernard-ng Yes, AFAIK they both use the See here:
|
alright in this case I don't have anything more to do on my side, is there anything to modify before merging ? |
Like I suggested in #2234 (comment) please remove all of the unneeded commits that are in the PR, to clean things up. |
Describe the bug
If you start typing the at-character ("@") followed by letters, the Converse UI will automatically try to auto-complete with the nickname of an occupant of the room.
For example, when I type "@ ber" I get this:
One thing that would be an improvement, is if Converse would prioritize the user for which the nickname STARTS with the text that I typed
You see in the example above that both Bernard's name as well as Viktor's match
If I would have pressed 'tab' after typing "@ ber" then it would have auto-completed with Viktor's name, instead of Bernard's
I think 99% of the times, a user intends to select the user who's nickname starts with whatever is typed.
To Reproduce
type a text starting with "@"
Expected behavior
prioritize the user for which the nickname STARTS with the text that is typed
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: