1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-19 08:52:22 +01:00

Contacts: Made Contact.inGroup() more failsafe.

This commit is contained in:
Thomas Tanghus 2013-01-08 05:49:40 +01:00
parent 38d6ba08c1
commit 290fdd46db

View File

@ -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;
};
/**