diff --git a/js/contacts.js b/js/contacts.js index 1ec28853..cfc46c4f 100644 --- a/js/contacts.js +++ b/js/contacts.js @@ -1196,17 +1196,17 @@ OC.Contacts = OC.Contacts || {}; * @returns Boolean */ Contact.prototype.inGroup = function(name) { - if(!this.data || this.data.CATEGORIES) { - return false; - } + var categories = this.getPreferredValue('CATEGORIES', []); + var found = false; - categories = this.data.CATEGORIES[0].value; - for(var i in categories) { - if(typeof categories[i] === 'string' && (name.toLowerCase() === categories[i].toLowerCase())) { - return true; + $.each(categories, function(idx, category) { + if(name.toLowerCase() == category.trim().toLowerCase()) { + found = true + return false; } - } - return false; + }); + + return found; }; /**