-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Populate missing profile config defaults #29330
Conversation
Signed-off-by: Christopher Ng <chrng8@gmail.com>
e019f64
to
bff02f5
Compare
Fixes it! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see question
$config = $this->configMapper->get($targetUser->getUID()); | ||
// Merge defaults with the existing config in case the defaults are missing | ||
$config->setConfigArray(array_merge($defaultProfileConfig, $config->getConfigArray())); | ||
$this->configMapper->update($config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not cause superflouus writes to the DB, does it? When nothing has changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No superfluous writes as it is handled here
server/lib/public/AppFramework/Db/QBMapper.php
Lines 185 to 189 in 49e727f
// if entity wasn't changed it makes no sense to run a db query | |
$properties = $entity->getUpdatedFields(); | |
if (\count($properties) === 0) { | |
return $entity; | |
} |
Merge defaults with the existing profile config queried from the database to ensure that all expected properties are set.