Skip to content
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

Merged
merged 2 commits into from
Oct 20, 2021

Conversation

Pytal
Copy link
Member

@Pytal Pytal commented Oct 20, 2021

Merge defaults with the existing profile config queried from the database to ensure that all expected properties are set.

Signed-off-by: Christopher Ng <chrng8@gmail.com>
@Pytal Pytal added bug 3. to review Waiting for reviews feature: profile PRs or issues related to the Profile feature (e.g. Profile page, API, etc.) labels Oct 20, 2021
@Pytal Pytal added this to the Nextcloud 23 milestone Oct 20, 2021
@Pytal Pytal requested a review from a team October 20, 2021 00:59
@Pytal Pytal self-assigned this Oct 20, 2021
@Pytal Pytal requested review from nickvergessen, ArtificialOwl and skjnldsv and removed request for a team October 20, 2021 00:59
Signed-off-by: Christopher Ng <chrng8@gmail.com>
@Pytal Pytal force-pushed the fix/missing-profile-config-defaults branch from e019f64 to bff02f5 Compare October 20, 2021 01:07
@skjnldsv
Copy link
Member

Fixes it! 👍

@skjnldsv skjnldsv requested a review from a team October 20, 2021 15:39
Copy link
Member

@blizzz blizzz left a 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);
Copy link
Member

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.

Copy link
Member Author

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

// if entity wasn't changed it makes no sense to run a db query
$properties = $entity->getUpdatedFields();
if (\count($properties) === 0) {
return $entity;
}

@blizzz blizzz merged commit 07863f3 into master Oct 20, 2021
@blizzz blizzz deleted the fix/missing-profile-config-defaults branch October 20, 2021 16:26
@Pytal Pytal added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Oct 20, 2021
@skjnldsv skjnldsv mentioned this pull request Oct 25, 2021
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug feature: profile PRs or issues related to the Profile feature (e.g. Profile page, API, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants