Skip to content
Prev Previous commit
Next Next commit
Fixing merged code
Signed-off-by: Jake Nabasny <[email protected]>
  • Loading branch information
slapcat committed Feb 5, 2024
commit 459355f4e8d6f90a97598232d6ed25d050efbd65
10 changes: 10 additions & 0 deletions apps/settings/src/constants/AccountPropertyConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const ACCOUNT_PROPERTY_ENUM = Object.freeze({
ROLE: 'role',
TWITTER: 'twitter',
WEBSITE: 'website',
BIRTHDATE: 'birthdate',
ANNIVERSARYDATE: 'anniversarydate',
})

/** Enum of account properties to human readable account property names */
Expand All @@ -61,6 +63,8 @@ export const ACCOUNT_PROPERTY_READABLE_ENUM = Object.freeze({
TWITTER: t('settings', 'X (formerly Twitter)'),
FEDIVERSE: t('settings', 'Fediverse (e.g. Mastodon)'),
WEBSITE: t('settings', 'Website'),
BIRTHDATE: t('settings', 'Birthday'),
ANNIVERSARYDATE: t('settings', 'Anniversary'),
})

export const NAME_READABLE_ENUM = Object.freeze({
Expand All @@ -78,6 +82,8 @@ export const NAME_READABLE_ENUM = Object.freeze({
[ACCOUNT_PROPERTY_ENUM.TWITTER]: ACCOUNT_PROPERTY_READABLE_ENUM.TWITTER,
[ACCOUNT_PROPERTY_ENUM.FEDIVERSE]: ACCOUNT_PROPERTY_READABLE_ENUM.FEDIVERSE,
[ACCOUNT_PROPERTY_ENUM.WEBSITE]: ACCOUNT_PROPERTY_READABLE_ENUM.WEBSITE,
[ACCOUNT_PROPERTY_ENUM.BIRTHDATE]: ACCOUNT_PROPERTY_READABLE_ENUM.BIRTHDATE,
[ACCOUNT_PROPERTY_ENUM.ANNIVERSARYDATE]: ACCOUNT_PROPERTY_READABLE_ENUM.ANNIVERSARYDATE,
})

/** Enum of profile specific sections to human readable names */
Expand All @@ -101,6 +107,8 @@ export const PROPERTY_READABLE_KEYS_ENUM = Object.freeze({
[ACCOUNT_PROPERTY_READABLE_ENUM.TWITTER]: ACCOUNT_PROPERTY_ENUM.TWITTER,
[ACCOUNT_PROPERTY_READABLE_ENUM.FEDIVERSE]: ACCOUNT_PROPERTY_ENUM.FEDIVERSE,
[ACCOUNT_PROPERTY_READABLE_ENUM.WEBSITE]: ACCOUNT_PROPERTY_ENUM.WEBSITE,
[ACCOUNT_PROPERTY_READABLE_ENUM.BIRTHDATE]: ACCOUNT_PROPERTY_ENUM.BIRTHDATE,
[ACCOUNT_PROPERTY_READABLE_ENUM.ANNIVERSARYDATE]: ACCOUNT_PROPERTY_ENUM.ANNIVERSARYDATE,
})

/**
Expand Down Expand Up @@ -143,6 +151,8 @@ export const PROPERTY_READABLE_SUPPORTED_SCOPES_ENUM = Object.freeze({
[ACCOUNT_PROPERTY_READABLE_ENUM.TWITTER]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],
[ACCOUNT_PROPERTY_READABLE_ENUM.FEDIVERSE]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],
[ACCOUNT_PROPERTY_READABLE_ENUM.WEBSITE]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],
[ACCOUNT_PROPERTY_READABLE_ENUM.BIRTHDATE]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],
[ACCOUNT_PROPERTY_READABLE_ENUM.ANNIVERSARYDATE]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],
})

/** List of readable account properties which aren't published to the lookup server */
Expand Down
21 changes: 0 additions & 21 deletions apps/user_ldap/lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,9 @@ class Configuration {
'ldapAttributeRole' => null,
'ldapAttributeHeadline' => null,
'ldapAttributeBiography' => null,
<<<<<<< HEAD
'ldapAdminGroup' => '',
=======
'ldapAttributeBirthDate' => null,
'ldapAttributeAnniversaryDate' => null,
>>>>>>> 06dd76fd26 (Add additional user profile attributes from LDAP)
];

public function __construct(string $configPrefix, bool $autoRead = true) {
Expand Down Expand Up @@ -496,18 +493,9 @@ public function getDefaults(): array {
'ldap_attr_role' => '',
'ldap_attr_headline' => '',
'ldap_attr_biography' => '',
<<<<<<< HEAD
<<<<<<< HEAD
'ldap_admin_group' => '',
=======
'ldap_attr_birthdate' => '',
'ldap_attr_anniversarydate' => '',
>>>>>>> 06dd76fd26 (Add additional user profile attributes from LDAP)
=======
'ldap_attr_birthdate' => '',
'ldap_attr_anniversarydate' => '',
'ldap_admin_group' => '',
>>>>>>> 7eaa573bac (resolve other conflicts)
];
}

Expand Down Expand Up @@ -584,18 +572,9 @@ public function getConfigTranslationArray(): array {
'ldap_attr_role' => 'ldapAttributeRole',
'ldap_attr_headline' => 'ldapAttributeHeadline',
'ldap_attr_biography' => 'ldapAttributeBiography',
<<<<<<< HEAD
<<<<<<< HEAD
'ldap_admin_group' => 'ldapAdminGroup',
=======
'ldap_attr_birthdate' => 'ldapAttributeBirthDate',
'ldap_attr_anniversarydate' => 'ldapAttributeAnniversaryDate',
>>>>>>> 06dd76fd26 (Add additional user profile attributes from LDAP)
=======
'ldap_attr_birthdate' => 'ldapAttributeBirthDate',
'ldap_attr_anniversarydate' => 'ldapAttributeAnniversaryDate',
'ldap_admin_group' => 'ldapAdminGroup',
>>>>>>> 7eaa573bac (resolve other conflicts)
];
return $array;
}
Expand Down
6 changes: 2 additions & 4 deletions apps/user_ldap/lib/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,11 @@
* @property string ldapAttributeRole
* @property string ldapAttributeHeadline
* @property string ldapAttributeBiography
<<<<<<< HEAD
* @property string ldapAdminGroup
=======
* @property string ldapAttributeBirthDate
* @property string ldapAttributeAnniversaryDate
>>>>>>> 06dd76fd26 (Add additional user profile attributes from LDAP)
*/
*/

class Connection extends LDAPUtility {
/**
* @var resource|\LDAP\Connection|null
Expand Down
13 changes: 13 additions & 0 deletions lib/private/Profile/ProfileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class ProfileManager implements IProfileManager {
IAccountManager::PROPERTY_HEADLINE,
IAccountManager::PROPERTY_ORGANISATION,
IAccountManager::PROPERTY_ROLE,
IAccountManager::PROPERTY_BIRTHDATE,
IAccountManager::PROPERTY_ANNIVERSARYDATE,
];

public function __construct(
Expand Down Expand Up @@ -268,6 +270,8 @@ public function getProfileFields(IUser $targetUser, ?IUser $visitingUser): array
// Add avatar visibility
$profileParameters['isUserAvatarVisible'] = $this->isProfileFieldVisible($property, $targetUser, $visitingUser);
break;
case IAccountManager::PROPERTY_BIRTHDATE:
case IAccountManager::PROPERTY_ANNIVERSARYDATE:
}
}

Expand Down Expand Up @@ -416,6 +420,15 @@ public function getProfileConfigWithMetadata(IUser $targetUser, ?IUser $visiting
'appId' => self::CORE_APP_ID,
'displayId' => $this->l10nFactory->get('lib')->t('Role'),
],
IAccountManager::PROPERTY_BIRTHDATE => [
'appId' => self::CORE_APP_ID,
'displayId' => $this->l10nFactory->get('lib')->t('Birthday'),
],
IAccountManager::PROPERTY_ANNIVERSARYDATE => [
'appId' => self::CORE_APP_ID,
'displayId' => $this->l10nFactory->get('lib')->t('Anniversary'),
],

];

$paramMetadata = array_merge($actionsMetadata, $propertiesMetadata);
Expand Down
2 changes: 2 additions & 0 deletions lib/public/Profile/IProfileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ interface IProfileManager {
IAccountManager::PROPERTY_PHONE => self::VISIBILITY_SHOW_USERS_ONLY,
IAccountManager::PROPERTY_TWITTER => self::VISIBILITY_SHOW,
IAccountManager::PROPERTY_WEBSITE => self::VISIBILITY_SHOW,
IAccountManager::PROPERTY_BIRTHDATE => self::VISIBILITY_SHOW_USERS_ONLY,
IAccountManager::PROPERTY_ANNIVERSARYDATE => self::VISIBILITY_SHOW_USERS_ONLY,
];

/**
Expand Down