Skip to content
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

Merged
merged 3 commits into from
Oct 20, 2023
Merged

Handle @topic mentions #5779

merged 3 commits into from
Oct 20, 2023

Conversation

chrisbobbe
Copy link
Contributor

@chrisbobbe chrisbobbe added a-message list a-compose/send Compose box, autocomplete, camera/upload, outbox, sending labels Oct 11, 2023
Comment on lines 115 to 125
// 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.
Copy link
Member

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.

@gnprice
Copy link
Member

gnprice commented Oct 11, 2023

Otherwise LGTM! Thanks for taking care of these.

chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this pull request Oct 18, 2023
…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.
@chrisbobbe
Copy link
Contributor Author

Thanks for the review! Revision pushed, with that change.

@gnprice
Copy link
Member

gnprice commented Oct 20, 2023

Thanks! Looks good; merging.

@gnprice gnprice merged commit 0f3cbae into zulip:main Oct 20, 2023
1 check passed
…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.
@chrisbobbe chrisbobbe deleted the pr-mention-topics branch October 21, 2023 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-compose/send Compose box, autocomplete, camera/upload, outbox, sending a-message list
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add @topic to typeahead Render @topic wildcard mentions correctly when displayed in a message feed.
2 participants