diff options
Diffstat (limited to 'lib/private/Profile')
-rw-r--r-- | lib/private/Profile/ProfileManager.php | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/lib/private/Profile/ProfileManager.php b/lib/private/Profile/ProfileManager.php index a7fdfcc62f4..18b53ba9a7e 100644 --- a/lib/private/Profile/ProfileManager.php +++ b/lib/private/Profile/ProfileManager.php @@ -92,6 +92,7 @@ class ProfileManager { */ private const PROFILE_PROPERTIES = [ IAccountManager::PROPERTY_ADDRESS, + IAccountManager::PROPERTY_AVATAR, IAccountManager::PROPERTY_BIOGRAPHY, IAccountManager::PROPERTY_DISPLAYNAME, IAccountManager::PROPERTY_HEADLINE, @@ -150,6 +151,11 @@ class ProfileManager { } } + if (in_array($action->getId(), self::PROFILE_PROPERTIES, true)) { + $this->logger->error('Cannot register action with ID: ' . $action->getId() . ', as it is used by a core account property.'); + return; + } + // Add action to associative array of actions $this->actions[$action->getId()] = $action; } @@ -252,16 +258,26 @@ class ProfileManager { // Add account properties foreach (self::PROFILE_PROPERTIES as $property) { - $profileParameters[$property] = - $this->isParameterVisible($targetUser, $visitingUser, $property) - // Explicitly set to null when value is empty string - ? ($account->getProperty($property)->getValue() ?: null) - : null; + switch ($property) { + case IAccountManager::PROPERTY_ADDRESS: + case IAccountManager::PROPERTY_BIOGRAPHY: + case IAccountManager::PROPERTY_DISPLAYNAME: + case IAccountManager::PROPERTY_HEADLINE: + case IAccountManager::PROPERTY_ORGANISATION: + case IAccountManager::PROPERTY_ROLE: + $profileParameters[$property] = + $this->isParameterVisible($targetUser, $visitingUser, $property) + // Explicitly set to null when value is empty string + ? ($account->getProperty($property)->getValue() ?: null) + : null; + break; + case IAccountManager::PROPERTY_AVATAR: + // Add avatar visibility + $profileParameters['isUserAvatarVisible'] = $this->isParameterVisible($targetUser, $visitingUser, $property); + break; + } } - // Add avatar visibility - $profileParameters['isUserAvatarVisible'] = $this->isParameterVisible($targetUser, $visitingUser, IAccountManager::PROPERTY_AVATAR); - // Add actions $profileParameters['actions'] = array_map( function (ILinkAction $action) { |