Skip to content

Commit

Permalink
compose: Remove @topic from autocomplete, for now
Browse files Browse the repository at this point in the history
It turns out that server support for this hasn't landed yet. Once it
has, we'll know what feature level to condition on.
  • Loading branch information
chrisbobbe authored and gnprice committed Nov 1, 2023
1 parent ec8a3d8 commit 5847f9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/autocomplete/PeopleAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ export default function PeopleAutocomplete(props: Props): Node {
);

const filteredUserGroups = getAutocompleteUserGroupSuggestions(userGroups, filter);
const wildcardMentionsForQuery = getWildcardMentionsForQuery(filter, destinationNarrow, _);
const wildcardMentionsForQuery = getWildcardMentionsForQuery(
filter,
destinationNarrow,
// TODO condition on feature level, once we know which one:
// https://chat.zulip.org/#narrow/stream/378-api-design/topic/.40topic/near/1669340
false,
_,
);
const filteredUsers = getAutocompleteSuggestion(users, filter, ownUserId, mutedUsers);

if (filteredUserGroups.length + filteredUsers.length === 0) {
Expand Down
7 changes: 6 additions & 1 deletion src/autocomplete/WildcardMentionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const descriptionOf = (
export const getWildcardMentionsForQuery = (
query: string,
destinationNarrow: Narrow,
topicMentionSupported: boolean,
_: GetText,
): $ReadOnlyArray<WildcardMentionType> => {
const queryMatchesWildcard = (type: WildcardMentionType): boolean =>
Expand Down Expand Up @@ -112,7 +113,11 @@ export const getWildcardMentionsForQuery = (
}

// Then show @-topic if it applies.
if (isStreamOrTopicNarrow(destinationNarrow) && queryMatchesWildcard(WildcardMentionType.Topic)) {
if (
topicMentionSupported
&& isStreamOrTopicNarrow(destinationNarrow)
&& queryMatchesWildcard(WildcardMentionType.Topic)
) {
results.push(WildcardMentionType.Topic);
}

Expand Down

0 comments on commit 5847f9e

Please sign in to comment.