From 05b73329aabf8ca668385fd236d085b0da546fdc Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Wed, 11 Oct 2023 14:14:04 -0700 Subject: [PATCH] autocomplete: Add @topic to @-mention autocomplete Fixes: #5772 --- src/autocomplete/WildcardMentionItem.js | 10 ++++++++++ static/translations/messages_en.json | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/autocomplete/WildcardMentionItem.js b/src/autocomplete/WildcardMentionItem.js index 4c7a715cb1b..062c7d0bc3e 100644 --- a/src/autocomplete/WildcardMentionItem.js +++ b/src/autocomplete/WildcardMentionItem.js @@ -26,6 +26,7 @@ export enum WildcardMentionType { All = 0, Everyone = 1, Stream = 2, + Topic = 3, } /** @@ -45,6 +46,8 @@ const englishCanonicalStringOf = (type: WildcardMentionType): string => { return 'everyone'; case WildcardMentionType.Stream: return 'stream'; + case WildcardMentionType.Topic: + return 'topic'; } }; @@ -74,6 +77,8 @@ const descriptionOf = ( ); case WildcardMentionType.Stream: return _('Notify stream'); + case WildcardMentionType.Topic: + return _('Notify topic'); } }; @@ -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; }; diff --git a/static/translations/messages_en.json b/static/translations/messages_en.json index 443b654afb8..c9adb956ca2 100644 --- a/static/translations/messages_en.json +++ b/static/translations/messages_en.json @@ -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",