-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Allow the user to delete the description #39229
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
Conversation
|
Hi @mattsherman, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
Test Results SummaryCommit SHA: 4373e02
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
mattsherman
left a comment
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.
Works as expected.
I think the naming can be clarified a bit to make it more clear that the description is only cleared if it is "empty".
| * Internal dependencies | ||
| */ | ||
|
|
||
| function clearDescription( blocks: BlockInstance[] ) { |
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.
How about calling this clearDescriptionIfEmpty?
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.
Yep I was thinking about this or something similar but I could not find a good name for this. I also considered IfEmpty but since blocks list is not empty it was a little confusing for me. It should be something like remove the first block if its content is empty and it's just the only one block in the block list. Can you resume this in a couple of words?
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.
done -> 4373e02
| // By default the blocks variable always contains one paragraph | ||
| // block with empty content, that causes the desciption to never | ||
| // be empty. The next line removes the default block to keep | ||
| // the description empty. |
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 think that if you rename the function as suggested above, you can also move this comment inside the function, as it isn't needed here with a more specific function name and the comment really helps to better understand the function implementation.
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.
done -> 4373e02
mattsherman
left a comment
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 making those adjustments, @mdperez86 -- looks good! Nice work.
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes #38853
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Changelog entry
Significance
Type
Message
Comment