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

allow fullname to be set as empty string #21667

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Mash707
Copy link

@Mash707 Mash707 commented Mar 3, 2025

Closes #21604

@Mash707
Copy link
Author

Mash707 commented Mar 3, 2025

!edited_real_name evaluates to true when edited_real_name is null, undefined, ""(empty string). I have modified it such that the function returns only when it is null or undefined thus allowing empty string to be defined.
@garrett have a look at this. I also see a TODO mentioned if required I can work upon it in this PR.
https://github.com/cockpit-project/cockpit/blob/1101d335b4e88ead38d5fa5c288230736878e4ae/pkg/users/account-details.js#L117C9-L117C38

@@ -109,7 +109,7 @@ export function AccountDetails({ accounts, groups, current_user, user, shells })
const [edited_locked, set_edited_locked] = useState(null);

function change_real_name() {
if (!edited_real_name)
if (edited_real_name == null || edited_real_name == undefined)
Copy link
Member

Choose a reason for hiding this comment

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

I think this probably goes in the right direction.

However, wouldn't we want === instead of ==, as JavaScript should have the extra = in comparisons? Otherwise types can be silently converted via implicit type conversion.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness

Copy link
Author

Choose a reason for hiding this comment

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

Correct. It might have gone over my head. I will make the necessary changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not being able to change the full name to empty
2 participants