-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
Handle @topic mentions #5779
Handle @topic mentions #5779
Conversation
// This assumes that we'll never want to show two suggestions for one query. | ||
// That's OK, as long as all of WildcardMentionType's members are synonyms, | ||
// and it's nice not to crowd the autocomplete with multiple items that mean | ||
// the same thing. But we'll need to adapt if it turns out that all the | ||
// members aren't synonyms. | ||
const match = ( | ||
isStreamOrTopicNarrow(destinationNarrow) ? kOrderedTypesWithStream : kOrderedTypesWithoutStream | ||
).find( | ||
): $ReadOnlyArray<WildcardMentionType> => | ||
// Since not all of WildcardMentionType's members are synonyms -- "topic" | ||
// has a different meaning than "all", "everyone", and "stream" -- show | ||
// all matches instead of just the first. That's so e.g. a query for | ||
// "topic" in the user's language can't be short-circuited by the "all" | ||
// result. |
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.
Hmm, this means a little UX regression in that the results will now be crowded with several items that mean the same thing.
I think it won't be too complicated to maintain our existing nice behavior of suppressing dupes, while not inappropriately suppressing @topic
. The main thing to do in the code is that in retrospect the existing version probably stretches too hard to make it table-driven, with those constants kOrderedTypes…
, rather than writing out logic in code in the function. If we do the latter, it becomes pretty straightforward to add @topic
without losing dupe suppression on the others.
I just wrote up a version of that; I'll push it to the PR branch.
Otherwise LGTM! Thanks for taking care of these. |
…tion As Greg suggests: zulip#5779 (comment) > The main thing to do in the code is that in retrospect the > existing version probably stretches too hard to make it > table-driven, with those constants `kOrderedTypes…`, rather than > writing out logic in code in the function. If we do the latter, it > becomes pretty straightforward to add `@topic` without losing dupe > suppression on the others.
ee4541f
to
9a79879
Compare
Thanks for the review! Revision pushed, with that change. |
Thanks! Looks good; merging. |
9a79879
to
0f3cbae
Compare
…tion As Greg suggests: zulip#5779 (comment) > The main thing to do in the code is that in retrospect the > existing version probably stretches too hard to make it > table-driven, with those constants `kOrderedTypes…`, rather than > writing out logic in code in the function. If we do the latter, it > becomes pretty straightforward to add `@topic` without losing dupe > suppression on the others.
Fixes these two issues:
@topic
to typeahead #5772Fixes: #5746
Fixes: #5772