From 9cd522a7907c5cff72ac76e02a2de02dd989c9be Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Mon, 19 Jan 2015 20:42:57 +0100 Subject: Fix autocomplete with groups --- view/js/autocomplete.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view/js') diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index f695a5dbf..50ba99279 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -13,7 +13,7 @@ function contact_search(term, callback, backend_url, type, extra_channels) { for(t in contact_search.cache[bt]) { if(lterm.indexOf(t) >= 0) { // A more broad search has been performed already, so use those results // Filter old results locally - var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || x.nick.toLowerCase().indexOf(lterm) >= 0); }); + var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because groups don't have one matching.unshift({taggable:false, text: term, replace: term}); setTimeout(function() { callback(matching)} , 1); // Use "pseudo-thread" to avoid some problems return; -- cgit v1.2.3