Skip to content

Commit

Permalink
autocomplete: Add @topic to @-mention autocomplete
Browse files Browse the repository at this point in the history
Fixes: zulip#5772
  • Loading branch information
chrisbobbe committed Oct 18, 2023
1 parent f9b9d23 commit 0a9682a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/autocomplete/WildcardMentionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export enum WildcardMentionType {
All = 0,
Everyone = 1,
Stream = 2,
Topic = 3,
}

/**
Expand All @@ -45,6 +46,8 @@ const englishCanonicalStringOf = (type: WildcardMentionType): string => {
return 'everyone';
case WildcardMentionType.Stream:
return 'stream';
case WildcardMentionType.Topic:
return 'topic';
}
};

Expand Down Expand Up @@ -74,6 +77,8 @@ const descriptionOf = (
);
case WildcardMentionType.Stream:
return _('Notify stream');
case WildcardMentionType.Topic:
return _('Notify topic');
}
};

Expand Down Expand Up @@ -106,6 +111,11 @@ export const getWildcardMentionsForQuery = (
results.push(WildcardMentionType.Stream);
}

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

return results;
};

Expand Down
2 changes: 2 additions & 0 deletions static/translations/messages_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"all": "all",
"everyone": "everyone",
"stream": "stream",
"topic": "topic",
"Notify stream": "Notify stream",
"Notify topic": "Notify topic",
"Notify recipients": "Notify recipients",
"Notify everyone": "Notify everyone",
"Cannot open image": "Cannot open image",
Expand Down

0 comments on commit 0a9682a

Please sign in to comment.