Skip to content

Commit fd9f7a7

Browse files
committed
fix(profile): Directly migrate to OCP constants
Signed-off-by: Joas Schilling <[email protected]>
1 parent 2353d3c commit fd9f7a7

File tree

2 files changed

+4
-45
lines changed

2 files changed

+4
-45
lines changed

core/Db/ProfileConfig.php

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
namespace OC\Core\Db;
2828

29-
use OCP\Profile\IProfileManager;
3029
use function Safe\json_decode;
3130
use function Safe\json_encode;
3231
use \JsonSerializable;
@@ -40,46 +39,6 @@
4039
* @method void setConfig(string $config)
4140
*/
4241
class ProfileConfig extends Entity implements JsonSerializable {
43-
/**
44-
* Visible to users, guests, and public access
45-
*
46-
* @since 23.0.0
47-
* @deprecated 28.0.0 Use {@see IProfileManager::VISIBILITY_SHOW} instead
48-
*/
49-
public const VISIBILITY_SHOW = IProfileManager::VISIBILITY_SHOW;
50-
51-
/**
52-
* Visible to users and guests
53-
*
54-
* @since 23.0.0
55-
* @deprecated 28.0.0 Use {@see IProfileManager::VISIBILITY_SHOW_USERS_ONLY} instead
56-
*/
57-
public const VISIBILITY_SHOW_USERS_ONLY = IProfileManager::VISIBILITY_SHOW_USERS_ONLY;
58-
59-
/**
60-
* Visible to nobody
61-
*
62-
* @since 23.0.0
63-
* @deprecated 28.0.0 Use {@see IProfileManager::VISIBILITY_HIDE} instead
64-
*/
65-
public const VISIBILITY_HIDE = IProfileManager::VISIBILITY_HIDE;
66-
67-
/**
68-
* Default account property visibility
69-
*
70-
* @since 23.0.0
71-
* @deprecated 28.0.0 Use {@see IProfileManager::DEFAULT_PROPERTY_VISIBILITY} instead
72-
*/
73-
public const DEFAULT_PROPERTY_VISIBILITY = IProfileManager::DEFAULT_PROPERTY_VISIBILITY;
74-
75-
/**
76-
* Default visibility
77-
*
78-
* @since 23.0.0
79-
* @deprecated 28.0.0 Use {@see IProfileManager::DEFAULT_VISIBILITY} instead
80-
*/
81-
public const DEFAULT_VISIBILITY = IProfileManager::DEFAULT_VISIBILITY;
82-
8342
/** @var string */
8443
protected $userId;
8544

lib/private/Profile/ProfileManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function isProfileFieldVisible(string $profileField, IUser $targetUser, ?
205205
$visibility = $this->getProfileConfig($targetUser, $visitingUser)[$profileField]['visibility'];
206206
// Handle profile visibility and account property scope
207207

208-
if ($visibility === ProfileConfig::VISIBILITY_SHOW_USERS_ONLY) {
208+
if ($visibility === self::VISIBILITY_SHOW_USERS_ONLY) {
209209
if (empty($scope)) {
210210
return $visitingUser !== null;
211211
}
@@ -219,7 +219,7 @@ public function isProfileFieldVisible(string $profileField, IUser $targetUser, ?
219219
};
220220
}
221221

222-
if ($visibility === ProfileConfig::VISIBILITY_SHOW) {
222+
if ($visibility === self::VISIBILITY_SHOW) {
223223
if (empty($scope)) {
224224
return true;
225225
}
@@ -318,12 +318,12 @@ private function getDefaultProfileConfig(IUser $targetUser, ?IUser $visitingUser
318318
// Construct the default config for actions
319319
$actionsConfig = [];
320320
foreach ($this->getActions($targetUser, $visitingUser) as $action) {
321-
$actionsConfig[$action->getId()] = ['visibility' => ProfileConfig::DEFAULT_VISIBILITY];
321+
$actionsConfig[$action->getId()] = ['visibility' => self::DEFAULT_VISIBILITY];
322322
}
323323

324324
// Construct the default config for account properties
325325
$propertiesConfig = [];
326-
foreach (ProfileConfig::DEFAULT_PROPERTY_VISIBILITY as $property => $visibility) {
326+
foreach (self::DEFAULT_PROPERTY_VISIBILITY as $property => $visibility) {
327327
$propertiesConfig[$property] = ['visibility' => $visibility];
328328
}
329329

0 commit comments

Comments
 (0)