Fix issues with left-sidebar stream search and multiple words.

If you typed in more than one word for a stream with multiple words in
it's name, it would not show up in the search list. This fixes that
and adds some more tests covering the entire functionality of the
filter.
This commit is contained in:
Sampriti Panda
2017-09-15 10:23:25 +05:30
committed by Tim Abbott
parent c4b506998f
commit e98d7a6ee8
2 changed files with 19 additions and 5 deletions

View File

@@ -25,8 +25,10 @@ function filter_streams_by_search(streams, search_term) {
var filtered_streams = _.filter(streams, function (stream) {
return _.any(search_terms, function (search_term) {
var lower_stream_name = stream.toLowerCase().split(" ");
return _.any(lower_stream_name, function (name) {
var lower_stream_name = stream.toLowerCase();
var cands = lower_stream_name.split(" ");
cands.push(lower_stream_name);
return _.any(cands, function (name) {
return name.indexOf(search_term) === 0;
});
});