Skip to content

Commit

Permalink
respect disabled profiles in reference widget
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Nov 29, 2024
1 parent b065024 commit a705e1a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/Reference/ProfilePickerReferenceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,25 @@ public function resolveReference(string $referenceText): ?IReference {
if ($user === null) {
return null;
}
$account = $this->accountManager->getAccount($user);
$profileEnabled = $account->getProperty(IAccountManager::PROPERTY_PROFILE_ENABLED)->getValue() === '1';
if (!$profileEnabled) {
return null;
}

$reference = new Reference($referenceText);

$userDisplayName = $user->getDisplayName();
$userEmail = $user->getEMailAddress();
$userAvatarUrl = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $userId, 'size' => '64']);

$bio = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_BIOGRAPHY);
$bio = $account->getProperty(IAccountManager::PROPERTY_BIOGRAPHY);
$bio = $bio->getScope() !== IAccountManager::SCOPE_PRIVATE ? $bio->getValue() : null;
$headline = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_HEADLINE);
$location = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_ADDRESS);
$website = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_WEBSITE);
$organisation = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_ORGANISATION);
$role = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_ROLE);
$headline = $account->getProperty(IAccountManager::PROPERTY_HEADLINE);
$location = $account->getProperty(IAccountManager::PROPERTY_ADDRESS);
$website = $account->getProperty(IAccountManager::PROPERTY_WEBSITE);
$organisation = $account->getProperty(IAccountManager::PROPERTY_ORGANISATION);
$role = $account->getProperty(IAccountManager::PROPERTY_ROLE);

// for clients who can't render the reference widgets
$reference->setTitle($userDisplayName);
Expand Down

0 comments on commit a705e1a

Please sign in to comment.