aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/AccountManager.php23
-rw-r--r--lib/private/Profile/ProfileManager.php8
-rw-r--r--lib/public/Accounts/IAccountManager.php22
-rw-r--r--lib/public/Profile/IProfileManager.php3
4 files changed, 38 insertions, 18 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index cc81a852cdf..2ab2beb6d3e 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -64,19 +64,20 @@ class AccountManager implements IAccountManager {
* The list of default scopes for each property.
*/
public const DEFAULT_SCOPES = [
- self::PROPERTY_DISPLAYNAME => self::SCOPE_FEDERATED,
self::PROPERTY_ADDRESS => self::SCOPE_LOCAL,
- self::PROPERTY_WEBSITE => self::SCOPE_LOCAL,
- self::PROPERTY_EMAIL => self::SCOPE_FEDERATED,
self::PROPERTY_AVATAR => self::SCOPE_FEDERATED,
- self::PROPERTY_PHONE => self::SCOPE_LOCAL,
- self::PROPERTY_TWITTER => self::SCOPE_LOCAL,
+ self::PROPERTY_BIOGRAPHY => self::SCOPE_LOCAL,
+ self::PROPERTY_BIRTHDATE => self::SCOPE_LOCAL,
+ self::PROPERTY_DISPLAYNAME => self::SCOPE_FEDERATED,
+ self::PROPERTY_EMAIL => self::SCOPE_FEDERATED,
self::PROPERTY_FEDIVERSE => self::SCOPE_LOCAL,
+ self::PROPERTY_HEADLINE => self::SCOPE_LOCAL,
self::PROPERTY_ORGANISATION => self::SCOPE_LOCAL,
+ self::PROPERTY_PHONE => self::SCOPE_LOCAL,
+ self::PROPERTY_PRONOUNS => self::SCOPE_FEDERATED,
self::PROPERTY_ROLE => self::SCOPE_LOCAL,
- self::PROPERTY_HEADLINE => self::SCOPE_LOCAL,
- self::PROPERTY_BIOGRAPHY => self::SCOPE_LOCAL,
- self::PROPERTY_BIRTHDATE => self::SCOPE_LOCAL,
+ self::PROPERTY_TWITTER => self::SCOPE_LOCAL,
+ self::PROPERTY_WEBSITE => self::SCOPE_LOCAL,
];
public function __construct(
@@ -679,6 +680,12 @@ class AccountManager implements IAccountManager {
'name' => self::PROPERTY_PROFILE_ENABLED,
'value' => $this->isProfileEnabledByDefault($this->config) ? '1' : '0',
],
+
+ [
+ 'name' => self::PROPERTY_PRONOUNS,
+ 'value' => '',
+ 'scope' => $scopes[self::PROPERTY_PRONOUNS],
+ ],
];
}
diff --git a/lib/private/Profile/ProfileManager.php b/lib/private/Profile/ProfileManager.php
index 5e36a9c2f56..9d3d94fab21 100644
--- a/lib/private/Profile/ProfileManager.php
+++ b/lib/private/Profile/ProfileManager.php
@@ -66,6 +66,7 @@ class ProfileManager implements IProfileManager {
IAccountManager::PROPERTY_HEADLINE,
IAccountManager::PROPERTY_ORGANISATION,
IAccountManager::PROPERTY_ROLE,
+ IAccountManager::PROPERTY_PRONOUNS,
];
public function __construct(
@@ -222,7 +223,7 @@ class ProfileManager implements IProfileManager {
/**
* Return the profile parameters of the target user that are visible to the visiting user
* in an associative array
- * @return array{userId: string, address?: string|null, biography?: string|null, displayname?: string|null, headline?: string|null, isUserAvatarVisible?: bool, organisation?: string|null, role?: string|null, actions: list<array{id: string, icon: string, title: string, target: ?string}>}
+ * @return array{userId: string, address?: string|null, biography?: string|null, displayname?: string|null, headline?: string|null, isUserAvatarVisible?: bool, organisation?: string|null, pronouns?: string|null, role?: string|null, actions: list<array{id: string, icon: string, title: string, target: ?string}>}
*/
public function getProfileFields(IUser $targetUser, ?IUser $visitingUser): array {
$account = $this->accountManager->getAccount($targetUser);
@@ -241,6 +242,7 @@ class ProfileManager implements IProfileManager {
case IAccountManager::PROPERTY_HEADLINE:
case IAccountManager::PROPERTY_ORGANISATION:
case IAccountManager::PROPERTY_ROLE:
+ case IAccountManager::PROPERTY_PRONOUNS:
$profileParameters[$property] =
$this->isProfileFieldVisible($property, $targetUser, $visitingUser)
// Explicitly set to null when value is empty string
@@ -399,6 +401,10 @@ class ProfileManager implements IProfileManager {
'appId' => self::CORE_APP_ID,
'displayId' => $this->l10nFactory->get('lib')->t('Role'),
],
+ IAccountManager::PROPERTY_PRONOUNS => [
+ 'appId' => self::CORE_APP_ID,
+ 'displayId' => $this->l10nFactory->get('lib')->t('Pronouns'),
+ ],
];
$paramMetadata = array_merge($actionsMetadata, $propertiesMetadata);
diff --git a/lib/public/Accounts/IAccountManager.php b/lib/public/Accounts/IAccountManager.php
index 33477db7679..a15651eb5e6 100644
--- a/lib/public/Accounts/IAccountManager.php
+++ b/lib/public/Accounts/IAccountManager.php
@@ -162,25 +162,31 @@ interface IAccountManager {
public const PROPERTY_BIRTHDATE = 'birthdate';
/**
+ * @since 31.0.0
+ */
+ public const PROPERTY_PRONOUNS = 'pronouns';
+
+ /**
* The list of allowed properties
*
* @since 25.0.0
*/
public const ALLOWED_PROPERTIES = [
+ self::PROPERTY_ADDRESS,
self::PROPERTY_AVATAR,
+ self::PROPERTY_BIOGRAPHY,
+ self::PROPERTY_BIRTHDATE,
self::PROPERTY_DISPLAYNAME,
- self::PROPERTY_PHONE,
self::PROPERTY_EMAIL,
- self::PROPERTY_WEBSITE,
- self::PROPERTY_ADDRESS,
- self::PROPERTY_TWITTER,
self::PROPERTY_FEDIVERSE,
- self::PROPERTY_ORGANISATION,
- self::PROPERTY_ROLE,
self::PROPERTY_HEADLINE,
- self::PROPERTY_BIOGRAPHY,
+ self::PROPERTY_ORGANISATION,
+ self::PROPERTY_PHONE,
self::PROPERTY_PROFILE_ENABLED,
- self::PROPERTY_BIRTHDATE,
+ self::PROPERTY_PRONOUNS,
+ self::PROPERTY_ROLE,
+ self::PROPERTY_TWITTER,
+ self::PROPERTY_WEBSITE,
];
diff --git a/lib/public/Profile/IProfileManager.php b/lib/public/Profile/IProfileManager.php
index 3f5802a5441..0a1e6733e58 100644
--- a/lib/public/Profile/IProfileManager.php
+++ b/lib/public/Profile/IProfileManager.php
@@ -54,6 +54,7 @@ interface IProfileManager {
IAccountManager::PROPERTY_PHONE => self::VISIBILITY_SHOW_USERS_ONLY,
IAccountManager::PROPERTY_TWITTER => self::VISIBILITY_SHOW,
IAccountManager::PROPERTY_WEBSITE => self::VISIBILITY_SHOW,
+ IAccountManager::PROPERTY_PRONOUNS => self::VISIBILITY_SHOW,
];
/**
@@ -82,7 +83,7 @@ interface IProfileManager {
* Return the profile parameters of the target user that are visible to the visiting user
* in an associative array
*
- * @return array{userId: string, address?: ?string, biography?: ?string, displayname?: ?string, headline?: ?string, isUserAvatarVisible?: bool, organisation?: ?string, role?: ?string, actions: list<array{id: string, icon: string, title: string, target: ?string}>}
+ * @return array{userId: string, address?: string|null, biography?: string|null, displayname?: string|null, headline?: string|null, isUserAvatarVisible?: bool, organisation?: string|null, pronouns?: string|null, role?: string|null, actions: list<array{id: string, icon: string, title: string, target: ?string}>}
* @since 28.0.0
*/
public function getProfileFields(IUser $targetUser, ?IUser $visitingUser): array;