diff options
author | Johannes Merkel <mail@johannesgge.de> | 2023-06-23 18:40:46 +0200 |
---|---|---|
committer | Johannes <74607597+JohannesGGE@users.noreply.github.com> | 2023-07-03 17:55:18 +0200 |
commit | eda3824d91107ed0ea223bca060a802a235abdab (patch) | |
tree | 1f65894d50094a95c1557da20679e78beb5b4787 /apps/dav/lib/CardDAV | |
parent | 646dfd2a40aa79b8fed8be314070bb8f629a6edc (diff) | |
download | nextcloud-server-eda3824d91107ed0ea223bca060a802a235abdab.tar.gz nextcloud-server-eda3824d91107ed0ea223bca060a802a235abdab.zip |
enh(sab): Add profileUrl to SAB
Signed-off-by: Johannes Merkel <mail@johannesgge.de>
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; |