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:
parent
38d6ba08c1
commit
290fdd46db
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user