Skip to content

Conversation

@mdperez86
Copy link
Contributor

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:

  1. Follow the steps described in Allow the user to delete the description #38853

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement

Message

Comment

@mdperez86 mdperez86 requested a review from a team July 13, 2023 15:20
@mdperez86 mdperez86 self-assigned this Jul 13, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 13, 2023

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:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@github-actions
Copy link
Contributor

github-actions bot commented Jul 13, 2023

Test Results Summary

Commit SHA: 4373e02

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 53s
E2E Tests1900018020820m 51s

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.

Copy link
Contributor

@mattsherman mattsherman left a 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[] ) {
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done -> 4373e02

Comment on lines 58 to 61
// 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.
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done -> 4373e02

@mdperez86 mdperez86 requested a review from mattsherman July 14, 2023 13:49
Copy link
Contributor

@mattsherman mattsherman left a 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.

@mdperez86 mdperez86 merged commit 24a655a into trunk Jul 14, 2023
@mdperez86 mdperez86 deleted the add/38853 branch July 14, 2023 15:00
@github-actions github-actions bot added this to the 8.0.0 milestone Jul 14, 2023
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.

Allow the user to delete the description

3 participants