Browse Source

fix(profile): Directly migrate to OCP constants

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v28.0.0beta1
Joas Schilling 7 months ago
parent
commit
fd9f7a7188
No account linked to committer's email address
2 changed files with 4 additions and 45 deletions
  1. 0
    41
      core/Db/ProfileConfig.php
  2. 4
    4
      lib/private/Profile/ProfileManager.php

+ 0
- 41
core/Db/ProfileConfig.php View File

@@ -26,7 +26,6 @@ declare(strict_types=1);

namespace OC\Core\Db;

use OCP\Profile\IProfileManager;
use function Safe\json_decode;
use function Safe\json_encode;
use \JsonSerializable;
@@ -40,46 +39,6 @@ use OCP\Profile\ParameterDoesNotExistException;
* @method void setConfig(string $config)
*/
class ProfileConfig extends Entity implements JsonSerializable {
/**
* Visible to users, guests, and public access
*
* @since 23.0.0
* @deprecated 28.0.0 Use {@see IProfileManager::VISIBILITY_SHOW} instead
*/
public const VISIBILITY_SHOW = IProfileManager::VISIBILITY_SHOW;

/**
* Visible to users and guests
*
* @since 23.0.0
* @deprecated 28.0.0 Use {@see IProfileManager::VISIBILITY_SHOW_USERS_ONLY} instead
*/
public const VISIBILITY_SHOW_USERS_ONLY = IProfileManager::VISIBILITY_SHOW_USERS_ONLY;

/**
* Visible to nobody
*
* @since 23.0.0
* @deprecated 28.0.0 Use {@see IProfileManager::VISIBILITY_HIDE} instead
*/
public const VISIBILITY_HIDE = IProfileManager::VISIBILITY_HIDE;

/**
* Default account property visibility
*
* @since 23.0.0
* @deprecated 28.0.0 Use {@see IProfileManager::DEFAULT_PROPERTY_VISIBILITY} instead
*/
public const DEFAULT_PROPERTY_VISIBILITY = IProfileManager::DEFAULT_PROPERTY_VISIBILITY;

/**
* Default visibility
*
* @since 23.0.0
* @deprecated 28.0.0 Use {@see IProfileManager::DEFAULT_VISIBILITY} instead
*/
public const DEFAULT_VISIBILITY = IProfileManager::DEFAULT_VISIBILITY;

/** @var string */
protected $userId;


+ 4
- 4
lib/private/Profile/ProfileManager.php View File

@@ -205,7 +205,7 @@ class ProfileManager implements IProfileManager {
$visibility = $this->getProfileConfig($targetUser, $visitingUser)[$profileField]['visibility'];
// Handle profile visibility and account property scope

if ($visibility === ProfileConfig::VISIBILITY_SHOW_USERS_ONLY) {
if ($visibility === self::VISIBILITY_SHOW_USERS_ONLY) {
if (empty($scope)) {
return $visitingUser !== null;
}
@@ -219,7 +219,7 @@ class ProfileManager implements IProfileManager {
};
}

if ($visibility === ProfileConfig::VISIBILITY_SHOW) {
if ($visibility === self::VISIBILITY_SHOW) {
if (empty($scope)) {
return true;
}
@@ -318,12 +318,12 @@ class ProfileManager implements IProfileManager {
// Construct the default config for actions
$actionsConfig = [];
foreach ($this->getActions($targetUser, $visitingUser) as $action) {
$actionsConfig[$action->getId()] = ['visibility' => ProfileConfig::DEFAULT_VISIBILITY];
$actionsConfig[$action->getId()] = ['visibility' => self::DEFAULT_VISIBILITY];
}

// Construct the default config for account properties
$propertiesConfig = [];
foreach (ProfileConfig::DEFAULT_PROPERTY_VISIBILITY as $property => $visibility) {
foreach (self::DEFAULT_PROPERTY_VISIBILITY as $property => $visibility) {
$propertiesConfig[$property] = ['visibility' => $visibility];
}


Loading…
Cancel
Save