-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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-profile): enable saving empty bio to clear user profile field #33927
base: develop
Are you sure you want to change the base?
Conversation
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: f3607b3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 35 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -79,7 +79,7 @@ async function saveUserProfile( | |||
await setUserStatusMethod(this.userId, settings.statusType as UserStatus, undefined); | |||
} | |||
|
|||
if (user && settings.bio) { | |||
if (user && settings.bio !== undefined) { |
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.
Could you add tests to ensure this behavior?
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.
Thanks for the suggestion. I have added the test case to check the setting of an empty bio field as requested in the commit #bf964f3 .Please let me know if there’s anything else you'd like me to adjust.
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.
I was thinking about this rather?
if (user && settings.bio !== undefined) { | |
if (user) { |
the very next line validates string or not already.
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.
Thank you for the suggestion. I think keeping the settings.bio !== undefined check in place allows users to have more control by ensuring that the bio field is only updated when explicitly provided. This approach prevents any unintentional updates, such as accidentally clearing the bio if the field is omitted from the request. Let me know if you’d like me to adjust this further.
…e handling - Added a test case to ensure the bio field is correctly set to an empty string. - Updated user identity handling to support clearing the bio field.
apps/meteor/app/lib/server/functions/getAvatarSuggestionForUser.ts
Outdated
Show resolved
Hide resolved
@@ -79,7 +79,7 @@ async function saveUserProfile( | |||
await setUserStatusMethod(this.userId, settings.statusType as UserStatus, undefined); | |||
} | |||
|
|||
if (user && settings.bio) { | |||
if (user && settings.bio !== undefined) { |
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.
I was thinking about this rather?
if (user && settings.bio !== undefined) { | |
if (user) { |
the very next line validates string or not already.
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.
there should be api test for this.
Proposed changes
This pull request enables the ability to save an empty bio in the user profile to clear out the bio field, which was previously uneditable if left empty.
Issue(s)
Steps to test or reproduce
Checklist