diff options
Diffstat (limited to 'apps/dav/lib/CardDAV')
-rw-r--r-- | apps/dav/lib/CardDAV/Converter.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/apps/dav/lib/CardDAV/Converter.php b/apps/dav/lib/CardDAV/Converter.php index b3d8b094d69..e19b52b4783 100644 --- a/apps/dav/lib/CardDAV/Converter.php +++ b/apps/dav/lib/CardDAV/Converter.php @@ -29,6 +29,7 @@ namespace OCA\DAV\CardDAV; use Exception; use OCP\Accounts\IAccountManager; +use OCP\IURLGenerator; use OCP\IImage; use OCP\IUser; use OCP\IUserManager; @@ -36,14 +37,17 @@ use Sabre\VObject\Component\VCard; use Sabre\VObject\Property\Text; class Converter { + /** @var IURLGenerator */ + private $urlGenerator; /** @var IAccountManager */ private $accountManager; private IUserManager $userManager; public function __construct(IAccountManager $accountManager, - IUserManager $userManager) { + IUserManager $userManager, IURLGenerator $urlGenerator) { $this->accountManager = $accountManager; $this->userManager = $userManager; + $this->urlGenerator = $urlGenerator; } public function createCardFromUser(IUser $user): ?VCard { @@ -88,6 +92,21 @@ class Converter { case IAccountManager::PROPERTY_WEBSITE: $vCard->add(new Text($vCard, 'URL', $property->getValue(), ['X-NC-SCOPE' => $scope])); break; + case IAccountManager::PROPERTY_PROFILE_ENABLED: + if ($property->getValue()) { + $vCard->add( + new Text( + $vCard, + 'X-SOCIALPROFILE', + $this->urlGenerator->linkToRouteAbsolute('core.ProfilePage.index', ['targetUserId' => $user->getUID()]), + [ + 'TYPE' => 'NEXTCLOUD', + 'X-NC-SCOPE' => IAccountManager::SCOPE_PUBLISHED + ] + ) + ); + } + break; case IAccountManager::PROPERTY_PHONE: $vCard->add(new Text($vCard, 'TEL', $property->getValue(), ['TYPE' => 'VOICE', 'X-NC-SCOPE' => $scope])); break; |