Addressbook: Fix contact categories were cleared when DAVx5 synced some Android clients

This commit is contained in:
nathangray 2021-04-30 09:26:00 -06:00
parent d8e892f7cf
commit 84e03fe334
2 changed files with 14 additions and 1 deletions

View File

@ -667,7 +667,19 @@ class addressbook_groupdav extends Api\CalDAV\Handler
}
elseif ($contactId > 0)
{
$contact['cat_id'] = null;
switch(Api\CalDAV\Handler::get_agent())
{
case 'davx5':
// DAVx5 does not always give us our categories back (Seems to depend on client)
if(is_null($contact['cat_id']) && $oldContact['cat_id'])
{
$contact['cat_id'] = $oldContact['cat_id'];
}
break;
default:
//
$contact['cat_id'] = null;
}
}
if (is_array($oldContact))
{

View File

@ -457,6 +457,7 @@ abstract class Handler
'evolution' => 'evolution', // Evolution
'thunderbird' => 'thunderbird', // SOGo connector for addressbook, no Lightning installed
'caldavsynchronizer'=> 'caldavsynchronizer', // Outlook CalDAV Synchroniser (https://caldavsynchronizer.org/)
'davx5' => 'davx5', // DAVx5 (https://www.davx5.com/)
) as $pattern => $name)
{
if (strpos($user_agent,$pattern) !== false)