Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

fix(user-profile): enable saving empty bio to clear user profile field

Open Curious-Goblin opened this issue 1 year ago • 11 comments

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.

  • This fix addresses an issue where users could not save changes if they attempted to clear their bio.
  • Implements validation adjustments to allow empty strings in the bio field.

Issue(s)

  • Fixes #33783

Steps to test or reproduce

  1. Navigate to the user profile section in the Rocket.Chat application.
  2. Attempt to clear the bio field and save changes.
  3. Confirm that the profile successfully updates with an empty bio field.

Checklist

  • [x] I have read the Contributing Guide.
  • [x] I have signed the CLA.
  • [x] Lint and unit tests pass locally.
  • [x] Added tests to verify this fix.
  • [x] Updated documentation as needed.

Curious-Goblin avatar Nov 09 '24 16:11 Curious-Goblin

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

dionisio-bot[bot] avatar Nov 09 '24 16:11 dionisio-bot[bot]

🦋 Changeset detected

Latest commit: 0ad565636303087c9cb026b3991deb45c681f4d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 35 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/network-broker Patch
@rocket.chat/models Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

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

changeset-bot[bot] avatar Nov 09 '24 16:11 changeset-bot[bot]

Hi @debdutdeb and @Gustrb, I’ve addressed all requested changes and have added the necessary tests. Could you please review the updates when you have time? Let me know if there’s anything else needed. Thank you!

Curious-Goblin avatar Nov 19 '24 10:11 Curious-Goblin

Hey, I agree with @debdutdeb we should have an API test for this as well

Gustrb avatar Nov 19 '24 12:11 Gustrb

Hey, I agree with @debdutdeb we should have an API test for this as well

Hey, I agree with @debdutdeb we should have an API test for this as well

Hi @Gustrb ,

I’ve added API tests for setting an empty bio field in the user profile. These tests include:

  1. Validating that the saveUserProfile method allows clearing the bio by setting it to an empty string (bio: ' ').
  2. Ensuring compliance with the bio length constraints while verifying the behavior for an empty bio input.

To the best of my knowledge, these cover the requested scenarios. Could you please review and let me know if they align with the tests you asked about? If not, I’d appreciate it if you could clarify which specific API tests are referred to here so I can address them.

Thank you!

Curious-Goblin avatar Nov 20 '24 12:11 Curious-Goblin

Hey @Curious-Goblin no need to keep merging develop into your branch, you're good. Let's run the CI to see, but looks good to me

Gustrb avatar Nov 20 '24 13:11 Gustrb

Hey @Curious-Goblin no need to keep merging develop into your branch, you're good. Let's run the CI to see, but looks good to me

ok, I will take care of it next time

Curious-Goblin avatar Nov 20 '24 13:11 Curious-Goblin

Hi @Gustrb,

I hope you're doing well! It's been a while since my last commit. I wanted to ask if you've had a chance to discuss it with the QA team. If there are any errors or improvements needed, please let me know—I’d be happy to address them promptly.

Thanks for your time and guidance!

Curious-Goblin avatar Dec 03 '24 06:12 Curious-Goblin

Hi @Gustrb , I wanted to follow up on this PR since it's been over a week without a response. Please let me know if any further changes or clarifications are needed from my side to move this forward. I’m happy to address any feedback

Curious-Goblin avatar Dec 16 '24 07:12 Curious-Goblin

Asking Gustavo to check. He had some other pressing items and had to delay this for a bit

casalsgh avatar Dec 16 '24 17:12 casalsgh

hello @Gustrb @casalsgh, its been another week, can someone please look into this pr and see if it is good to be merged or please help to get this pr a QA assured tag so that it can be merged or if is has some issues then let me know, I would be more than happy to contribute.

Curious-Goblin avatar Dec 22 '24 18:12 Curious-Goblin

hello @Gustrb @casalsgh, its been another week, can someone please look into this pr and see if it is good to be merged or please help to get this pr a QA assured tag so that it can be merged or if is has some issues then let me know, I would be more than happy to contribute.

Please note.

Nothing around here happens fast. It can take MONTHS.

There have also been the Christmas holidays which for many is up to two weeks and has only just finished.

It is with the team. You just have to be extremely patient.

reetp avatar Jan 07 '25 12:01 reetp

Hey, we don't merge PR's with failing tests, please fix that, then I will look into QA-ing

Gustrb avatar Jan 07 '25 12:01 Gustrb

regarding the failing tests thought that these tests which are failing I did not think that they were not the results on my changes but I will now look into my pr and try to change things accordingly so that the tests not fail

Curious-Goblin avatar Jan 07 '25 12:01 Curious-Goblin

The UI tests are not, but there is one API test that is: should reject invalid bio values (e.g., null):

Gustrb avatar Jan 07 '25 13:01 Gustrb

I want to ask that if empty bio and null bio are the same thing or not because this PR is solely made for one to save their bio as empty, and if the empty bio == null then the test which is rejecting null bio should fail in order to achieve the required feature

Curious-Goblin avatar Jan 07 '25 13:01 Curious-Goblin

The UI tests are not, but there is one API test that is: should reject invalid bio values (e.g., null):

I think that now this error should be resolved now, can you check on it please

Curious-Goblin avatar Jan 09 '25 12:01 Curious-Goblin

the api tests are still failing

Gustrb avatar Jan 09 '25 12:01 Gustrb

The UI tests are not, but there is one API test that is: should reject invalid bio values (e.g., null):

how can I see this message in the workflows I am not able find it out, can you help me ?

and I have tried running the test locally but for some reason I am not able to up the temporary mongo database due to which i am not able to run e2e tests and therefore I am asking you to give the approval for running the workflows

Curious-Goblin avatar Jan 10 '25 17:01 Curious-Goblin

to run the api tests (the ones that are failing you can do the following:

  • Open two terminals, I'll call them A and B
  • On terminal A: navigate to the RC folder and run: TEST_MODE=true yarn dsv
  • On terminal B: navigate to the RC folder and run yarn testapi

Note: only run the tests when the workspace is up and running

Gustrb avatar Jan 10 '25 17:01 Gustrb

to run the api tests (the ones that are failing you can do the following:

* Open two terminals, I'll call them A and B

* On terminal A: navigate to the RC folder and run: `TEST_MODE=true yarn dsv`

* On terminal B: navigate to the RC folder and run `yarn testapi`

Note: only run the tests when the workspace is up and running

Thank you very much for this guidance, I have now checked that the test which you told about, is passing successfully. Actually the problem was in the test, it was sending request to wrong api endpoint, upon fixing that the test passed without changing anything the saveUserProfile file.

Please give the approval to the workflows and see if anything more is required to be worked on.

Curious-Goblin avatar Jan 11 '25 11:01 Curious-Goblin

can you please give the approval to run the workflows ??

Curious-Goblin avatar Jan 11 '25 14:01 Curious-Goblin

can you please give the approval to run the workflows ??

This workflow requires approval from a maintainer. <<<<<<<<<<<<<<

Please read the link above: Learn more about approving workflows.

Approving workflow runs from public forks When an outside contributor submits a pull request to a public repository, a maintainer with write access may need to approve some workflow runs.

The answer will be no because only rocket devs have permissions to do this. Please stop asking. Thanks.

reetp avatar Jan 11 '25 14:01 reetp

can you please give the approval to run the workflows ??

This workflow requires approval from a maintainer. <<<<<<<<<<<<<<

Please read the link above: Learn more about approving workflows.

Approving workflow runs from public forks When an outside contributor submits a pull request to a public repository, a maintainer with write access may need to approve some workflow runs.

The answer will be no because only rocket devs have permissions to do this. Please stop asking. Thanks.

Gustrb has given the approvals for workflows for a several times and therefore I was asking to him so that we can move forward with the PR

Curious-Goblin avatar Jan 11 '25 14:01 Curious-Goblin

Gustrb has given the approvals for workflows for a several times and therefore I was asking to him so that we can move forward with the PR

Ok. In which case you may need to be patient - many of the main devs do not work on the weekend.

reetp avatar Jan 11 '25 15:01 reetp

ok

Curious-Goblin avatar Jan 11 '25 15:01 Curious-Goblin

to run the api tests (the ones that are failing you can do the following:

* Open two terminals, I'll call them A and B

* On terminal A: navigate to the RC folder and run: `TEST_MODE=true yarn dsv`

* On terminal B: navigate to the RC folder and run `yarn testapi`

Note: only run the tests when the workspace is up and running

Thank you very much for this guidance, I have now checked that the test which you told about, is passing successfully. Actually the problem was in the test, it was sending request to wrong api endpoint, upon fixing that the test passed without changing anything the saveUserProfile file.

Please give the approval to the workflows and see if anything more is required to be worked on.

Hello gustrb, I request you to give the approval for running the workflows as on my system the test passed

Curious-Goblin avatar Jan 13 '25 12:01 Curious-Goblin

Please, remove the changes in yarn.lock

Gustrb avatar Jan 13 '25 12:01 Gustrb

I have deleted the changes in the file.

But I made those changes in order to run the test which was written by me, I ran different commands written in the script but got that dependencies are missing like the one in the ss Screenshot from 2025-01-13 18-36-41

To overcome I installed required some dependencies locally and globally and then I reached this command TS_NODE_COMPILER_OPTIONS='{"module": "commonjs"}' yarn mocha tests/end-to-end/api/users.ts --config .mocharc.api.js which successfully ran my test but now as I reverted the changes to original this shows this error Screenshot from 2025-01-13 18-39-53

Maybe I am wrong, I don't know the proper way to run my test.

I was doing as you directed but got some errors

Curious-Goblin avatar Jan 13 '25 13:01 Curious-Goblin

Please, remove the changes in yarn.lock

I have reverted the changes in yarn.lock can you now see it

Curious-Goblin avatar Jan 13 '25 14:01 Curious-Goblin