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

fix: user:settings command when user is not available #47889

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Sep 11, 2024

Summary

If ignore-missing-user all sub commands work, except listing all settings for a user like occ user:settings --ignore-missing-user user core.

Checklist

If `ignore-missing-user` all sub commands work, except listing all settings
for a user like `occ user:settings --ignore-missing-user user core`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux added bug 3. to review Waiting for reviews labels Sep 11, 2024
@susnux susnux added this to the Nextcloud 31 milestone Sep 11, 2024
@susnux susnux requested review from a team, skjnldsv, yemkareems and come-nc and removed request for a team September 11, 2024 09:30
@susnux
Copy link
Contributor Author

susnux commented Sep 11, 2024

/backport to stable30

Comment on lines +234 to +237
if ($user !== null || $ignoreMissingUser === false) {
// Only add the display name if the user exists (or is expected to exist)
$settings['settings']['display_name'] = $user?->getDisplayName();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But simply changing for $user?-> would be enough, no?
All the rest of the PR is unnecessary to my understanding.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will wrongly output:

- core
  - something: 1234
- settings
  - display_name:

while with the current changes it correctly only lists the existing settings:
This will wrongly output:

- core
  - something: 1234

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then just using if ($user !== null) only would work? Why show the empty displayname when ignoreMissingUser is false?

@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Nov 15, 2024
@skjnldsv skjnldsv marked this pull request as draft November 15, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants