Prep for user-group autocomplete #1745
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These three commits add a
rank
field toMentionAutocompleteResult
, simply choosing 0 for wildcard results and 1 for user results, and abucketSort
on that new field. This is to prepare for more complicated ranking, with more ranks:Discussion: #mobile > user-group mentions #F233 @ 💬
@gnprice, I'm curious how you'd like the tests to change, to support that more complicated ranking. Would you be up for demonstrating that by writing a few commits? I think you could do that by converting the
compareByBotStatus
logic into the new bucket-sort-by-rank logic. If we're following web (sort_recipients
in web/src/typeahead_helper.ts), then some user-group results will need to be interleaved between human- and bot-user results, which calls for humans and bots to be in different buckets. As a first step, I think we'd go from two ranks (wildcard then users) to three ranks (wildcard then humans then bots); is that right?