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.

search_suggestion: Show operator autocomplete suggestion at top.

Pratik Chanda9dbd13d5a602
diff --git a/web/src/search_suggestion.ts b/web/src/search_suggestion.ts
index 6ccc25bd0fa..bb3c7847703 100644
--- a/web/src/search_suggestion.ts
+++ b/web/src/search_suggestion.ts
@@ -1045,6 +1045,7 @@ export function get_search_result(
// searching user probably is looking to make a group DM.
get_group_suggestions,
get_channels_filter_suggestions,
+ get_operator_suggestions,
get_is_filter_suggestions,
get_sent_by_me_suggestions,
get_channel_suggestions,
@@ -1053,18 +1054,17 @@ export function get_search_result(
get_people("dm-including"),
get_people("from"),
get_topic_suggestions,
- get_operator_suggestions,
get_has_filter_suggestions,
];
if (page_params.is_spectator) {
filterers = [
+ get_operator_suggestions,
get_is_filter_suggestions,
get_channel_suggestions,
get_people("sender"),
get_people("from"),
get_topic_suggestions,
- get_operator_suggestions,
get_has_filter_suggestions,
];
}
diff --git a/web/tests/search_suggestion.test.cjs b/web/tests/search_suggestion.test.cjs
index 0d69d5c440f..5d27ff8edbd 100644
--- a/web/tests/search_suggestion.test.cjs
+++ b/web/tests/search_suggestion.test.cjs
@@ -576,7 +576,7 @@ test("check_is_suggestions", ({override, mock_template}) => {
// but shows html description used for "channels:public"
query = "st";
suggestions = get_suggestions(query);
- expected = ["st", "streams:public", "is:starred", "channel:"];
+ expected = ["st", "streams:public", "channel:", "is:starred"];
assert.deepEqual(suggestions.strings, expected);
query = "channel:66 has:link is:sta";
@@ -600,22 +600,22 @@ test("sent_by_me_suggestions", ({override, mock_template}) => {
query = "sender";
suggestions = get_suggestions(query);
- let expected = ["sender", "sender:[email protected]", "sender:"];
+ let expected = ["sender", "sender:", "sender:[email protected]"];
assert.deepEqual(suggestions.strings, expected);
query = "-sender";
suggestions = get_suggestions(query);
- expected = ["-sender", "-sender:[email protected]", "-sender:"];
+ expected = ["-sender", "-sender:", "-sender:[email protected]"];
assert.deepEqual(suggestions.strings, expected);
query = "from";
suggestions = get_suggestions(query);
- expected = ["from", "sender:[email protected]", "sender:"];
+ expected = ["from", "sender:", "sender:[email protected]"];
assert.deepEqual(suggestions.strings, expected);
query = "-from";
suggestions = get_suggestions(query);
- expected = ["-from", "-sender:[email protected]", "-sender:"];
+ expected = ["-from", "-sender:", "-sender:[email protected]"];
assert.deepEqual(suggestions.strings, expected);
query = "sender:[email protected]";
@@ -995,7 +995,7 @@ test("operator_suggestions", ({override, mock_template}) => {
query = "-s";
suggestions = get_suggestions(query);
- expected = ["-s", "-sender:[email protected]", "-sender:", "-channel:"];
+ expected = ["-s", "-sender:", "-channel:", "-sender:[email protected]"];
assert.deepEqual(suggestions.strings, expected);
// 66 is a misc channel id.
@@ -1003,8 +1003,8 @@ test("operator_suggestions", ({override, mock_template}) => {
suggestions = get_suggestions(query);
expected = [
"channel:66 is:alerted -f",
- "channel:66 is:alerted -sender:[email protected]",
"channel:66 is:alerted -sender:",
+ "channel:66 is:alerted -sender:[email protected]",
"channel:66 is:alerted",
"channel:66",
];