Skip to content

Commit a705e1a

Browse files
committed
respect disabled profiles in reference widget
Signed-off-by: Julien Veyssier <[email protected]>
1 parent b065024 commit a705e1a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/Reference/ProfilePickerReferenceProvider.php

+11-6
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,25 @@ public function resolveReference(string $referenceText): ?IReference {
9898
if ($user === null) {
9999
return null;
100100
}
101+
$account = $this->accountManager->getAccount($user);
102+
$profileEnabled = $account->getProperty(IAccountManager::PROPERTY_PROFILE_ENABLED)->getValue() === '1';
103+
if (!$profileEnabled) {
104+
return null;
105+
}
101106

102107
$reference = new Reference($referenceText);
103108

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

108-
$bio = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_BIOGRAPHY);
113+
$bio = $account->getProperty(IAccountManager::PROPERTY_BIOGRAPHY);
109114
$bio = $bio->getScope() !== IAccountManager::SCOPE_PRIVATE ? $bio->getValue() : null;
110-
$headline = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_HEADLINE);
111-
$location = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_ADDRESS);
112-
$website = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_WEBSITE);
113-
$organisation = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_ORGANISATION);
114-
$role = $this->accountManager->getAccount($user)->getProperty(IAccountManager::PROPERTY_ROLE);
115+
$headline = $account->getProperty(IAccountManager::PROPERTY_HEADLINE);
116+
$location = $account->getProperty(IAccountManager::PROPERTY_ADDRESS);
117+
$website = $account->getProperty(IAccountManager::PROPERTY_WEBSITE);
118+
$organisation = $account->getProperty(IAccountManager::PROPERTY_ORGANISATION);
119+
$role = $account->getProperty(IAccountManager::PROPERTY_ROLE);
115120

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

0 commit comments

Comments
 (0)