Skip to content

Add a way to clear parent category #11428

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

Merged
merged 2 commits into from
May 8, 2024

Conversation

0nko
Copy link
Contributor

@0nko 0nko commented May 1, 2024

Implements #11427.

After fixing a parent category crash, I realized there's no way to clear the parent category once it's been set. This PR adds a button to do that.

Screen_recording_20240501_182608.webm

To test:

  1. Make sure you already have a category hierarchy with some categories having a parent
  2. Go to Products -> Tap on a product -> Tap on Categories
  3. Tap on a category with a parent category
  4. Tap on the Clear parent category button
  5. Notice the parent category is removed and the button is disabled
  6. Tap on Save
  7. Notice the changed category is not in the top level

@0nko 0nko added the type: enhancement A request for an enhancement. label May 1, 2024
@0nko 0nko added this to the 18.5 milestone May 1, 2024
@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
FlavorJalapeno
Build TypeDebug
Commit894493c
Direct Downloadwoocommerce-prototype-build-pr11428-894493c.apk

@codecov-commenter
Copy link

codecov-commenter commented May 1, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 40.84%. Comparing base (15144b2) to head (894493c).
Report is 134 commits behind head on trunk.

Files Patch % Lines
...products/categories/AddProductCategoryViewModel.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #11428      +/-   ##
============================================
- Coverage     40.84%   40.84%   -0.01%     
  Complexity     5215     5215              
============================================
  Files          1070     1070              
  Lines         62771    62773       +2     
  Branches       8571     8571              
============================================
  Hits          25639    25639              
- Misses        34825    34827       +2     
  Partials       2307     2307              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hichamboushaba hichamboushaba linked an issue May 2, 2024 that may be closed by this pull request
@samiuelson samiuelson modified the milestones: 18.5, 18.6 May 3, 2024
@hichamboushaba hichamboushaba self-assigned this May 8, 2024
Copy link
Member

@hichamboushaba hichamboushaba left a comment

Choose a reason for hiding this comment

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

Nice work @0nko, works well :shipit:

Comment on lines +167 to +171
if (parentCategoryName != null) {
binding.productCategoryParent.setHtmlText(parentCategoryName)
} else {
binding.productCategoryParent.setHtmlText("")
}
Copy link
Member

Choose a reason for hiding this comment

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

very minor np, we could shorten this with something like:

            binding.productCategoryParent.setHtmlText(parentCategoryName.orEmpty())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, good call 👍

@hichamboushaba hichamboushaba enabled auto-merge May 8, 2024 09:28
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 18.6. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@hichamboushaba hichamboushaba merged commit 0305d82 into trunk May 8, 2024
2 checks passed
@hichamboushaba hichamboushaba deleted the issue/11427-clear-parent-category branch May 8, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way to clear parent category
6 participants