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
|
* @returns Boolean
|
||||||
*/
|
*/
|
||||||
Contact.prototype.inGroup = function(name) {
|
Contact.prototype.inGroup = function(name) {
|
||||||
if(!this.data || this.data.CATEGORIES) {
|
var categories = this.getPreferredValue('CATEGORIES', []);
|
||||||
return false;
|
var found = false;
|
||||||
}
|
|
||||||
|
|
||||||
categories = this.data.CATEGORIES[0].value;
|
$.each(categories, function(idx, category) {
|
||||||
for(var i in categories) {
|
if(name.toLowerCase() == category.trim().toLowerCase()) {
|
||||||
if(typeof categories[i] === 'string' && (name.toLowerCase() === categories[i].toLowerCase())) {
|
found = true
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return false;
|
|
||||||
|
return found;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user