Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

topic_list: Only match is: queries in typeahead.

Tim Abbott428efeb1a436
diff --git a/web/src/topic_list.ts b/web/src/topic_list.ts
index 7ce52ce8843..89b98a1970d 100644
--- a/web/src/topic_list.ts
+++ b/web/src/topic_list.ts
@@ -544,9 +544,18 @@ export function setup_topic_search_typeahead(): void {
return typeahead_helper.render_topic_state(item.label);
},
matcher(item: TopicFilterPill, query: string) {
- return item.syntax.toLowerCase().startsWith(query.toLowerCase());
+ // This basically only matches if `is:` is in the query.
+ return (
+ query.includes(":") &&
+ (item.syntax.toLowerCase().startsWith(query.toLowerCase()) ||
+ (item.syntax.startsWith("-") &&
+ item.syntax.slice(1).toLowerCase().startsWith(query.toLowerCase())))
+ );
},
sorter(items: TopicFilterPill[]) {
+ // This sort order places "Unresolved topics" first
+ // always, which is good because that's almost always what
+ // users will want.
return items;
},
updater(item: TopicFilterPill) {
@@ -562,10 +571,6 @@ export function setup_topic_search_typeahead(): void {
stopAdvance: true,
// Use dropup, to match compose typeahead.
dropup: true,
- // Display typeahead menu when input gains focus and is empty.
- helpOnEmptyStrings: true,
- // Prevents displaying the typeahead menu when a pill is deleted via backspace.
- hideOnEmptyAfterBackspace: true,
};
topic_state_typeahead = new Typeahead(typeahead_input, options);