aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2021-10-23 10:52:44 +0200
committerGitHub <noreply@github.com>2021-10-23 10:52:44 +0200
commit7e117da4357cda049bc41c1e146e1b0f8a06ddee (patch)
treede58e7b3007cb52738468b0eba3f5327ae1c3655 /lib
parent811670a3adc4a253fd33dba2df5693e50e30ef23 (diff)
parente26d6f080ba978fb4c40b7caf190714a67e2e80c (diff)
downloadnextcloud-server-7e117da4357cda049bc41c1e146e1b0f8a06ddee.tar.gz
nextcloud-server-7e117da4357cda049bc41c1e146e1b0f8a06ddee.zip
Merge pull request #29397 from nextcloud/fix/noid/profile-missing-def-values
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/AccountManager.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 3416db56ba5..cbd51e71c4a 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -473,15 +473,16 @@ class AccountManager implements IAccountManager {
* Make sure that all expected data are set
*/
protected function addMissingDefaultValues(array $userData, array $defaultUserData): array {
- foreach ($defaultUserData as $i => $value) {
- // If property doesn't exists, initialize it
- if (!array_key_exists($i, $userData)) {
- $userData[$i] = [];
+ foreach ($defaultUserData as $defaultDataItem) {
+ // If property does not exist, initialize it
+ $userDataIndex = array_search($defaultDataItem['name'], array_column($userData, 'name'));
+ if ($userDataIndex === false) {
+ $userData[] = $defaultDataItem;
+ continue;
}
// Merge and extend default missing values
- $defaultValueIndex = array_search($value['name'], array_column($defaultUserData, 'name'));
- $userData[$i] = array_merge($defaultUserData[$defaultValueIndex], $userData[$i]);
+ $userData[$userDataIndex] = array_merge($defaultDataItem, $userData[$userDataIndex]);
}
return $userData;