fix(kdap): don't try to fetch for a nobody user

This commit is contained in:
Hivert Quentin
2025-07-28 13:28:30 +02:00
parent c8dd5535b3
commit 4d8cca10f6
+18 -10
View File
@@ -78,6 +78,14 @@
NSArray *cats, *newCats, *contactCategories;
ownerLogin = [[self clientObject] ownerInContext: context];
//if ownerLogin == @"nobody", meaning the current folder is not the personnal source of the user (it's the global address book)
//No need to fetch the user "nobody". Beware that if someone is really called nobody...
if([ownerLogin isEqualToString:@"nobody"])
{
cats = [self _languageContactsCategories];
return cats;
}
ud = [[SOGoUser userWithLogin: ownerLogin] userDefaults];
cats = [ud contactsCategories];
if (!cats)
@@ -85,16 +93,16 @@
contactCategories = [card categories];
if (contactCategories)
{
newCats = [cats mergedArrayWithArray: [contactCategories trimmedComponents]];
if ([newCats count] != [cats count])
{
cats = [newCats sortedArrayUsingSelector:
@selector (localizedCaseInsensitiveCompare:)];
[ud setContactsCategories: cats];
[ud synchronize];
}
}
{
newCats = [cats mergedArrayWithArray: [contactCategories trimmedComponents]];
if ([newCats count] != [cats count])
{
cats = [newCats sortedArrayUsingSelector:
@selector (localizedCaseInsensitiveCompare:)];
[ud setContactsCategories: cats];
[ud synchronize];
}
}
return cats;
}