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: Support multiple search pills creation.

Ryan Rehman21cdc261939c
diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.js
index 923beab978f..8ecbd598eb5 100644
--- a/frontend_tests/node_tests/search_suggestion.js
+++ b/frontend_tests/node_tests/search_suggestion.js
@@ -1202,10 +1202,10 @@ run_test('multiple_operators_without_pills', () => {
let suggestions = get_suggestions(base_query, query);
let expected = [
"is:private al",
- "is:private, is:alerted",
- "is:private, sender:[email protected]",
- "is:private, pm-with:[email protected]",
- "is:private, group-pm-with:[email protected]",
+ "is:private is:alerted",
+ "is:private sender:[email protected]",
+ "is:private pm-with:[email protected]",
+ "is:private group-pm-with:[email protected]",
];
assert.deepEqual(suggestions.strings, expected);
diff --git a/static/js/search_pill.js b/static/js/search_pill.js
index 4ef055912f5..4cbc06e011b 100644
--- a/static/js/search_pill.js
+++ b/static/js/search_pill.js
@@ -21,7 +21,11 @@ exports.create_pills = function (pill_container) {
};
exports.append_search_string = function (search_string, pill_widget) {
- pill_widget.appendValue(search_string);
+ const operators = Filter.parse(search_string);
+ for (const operator of operators) {
+ const input = Filter.unparse([operator]);
+ pill_widget.appendValue(input);
+ }
if (pill_widget.clear_text !== undefined) {
pill_widget.clear_text();
}
diff --git a/static/js/search_suggestion.js b/static/js/search_suggestion.js
index 3caca266180..17ef14cde6d 100644
--- a/static/js/search_suggestion.js
+++ b/static/js/search_suggestion.js
@@ -580,8 +580,7 @@ function make_attacher(base) {
function prepend_base(suggestion) {
if (base && base.description.length > 0) {
- const sep = page_params.search_pills_enabled ? ", " : " ";
- suggestion.search_string = base.search_string + sep + suggestion.search_string;
+ suggestion.search_string = base.search_string + " " + suggestion.search_string;
suggestion.description = base.description + ", " + suggestion.description;
}
}