Skip to content
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

Issue/12525 custom field creation #12531

Merged
merged 9 commits into from
Sep 11, 2024

Conversation

hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented Sep 5, 2024

Closes: #12525 Closes: #12532

Description

This PR adds the following:

  • Entry point to add new custom fields.
  • Validation to ensure we are not adding duplicate keys when creating new fields.
  • Validation to ensure we are not allowing keys that start with _.

Steps to reproduce

  1. Open an order that has at least one custom field (can be added in wp-admin from the Custom Fields section, later we'll enable showing the button even when the order doesn't have any fields).
  2. Tap on View Custom Fields section.
  3. Tap on the Add button.

Testing information

  • Test the happy path of adding a field and saving it.
  • Test adding a duplicate key.
  • Test adding/modifying a key to start with _

The tests that have been performed

The above.

Images/gif

Screen_recording_20240905_162925.mp4
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@hichamboushaba hichamboushaba added type: enhancement A request for an enhancement. feature: order details Related to order details. feature: product details Related to adding or editing products, includes product settings. labels Sep 5, 2024
@dangermattic
Copy link
Collaborator

dangermattic commented Sep 5, 2024

1 Warning
⚠️ This PR is assigned to the milestone 20.4. 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

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 5, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit9673681
Direct Downloadwoocommerce-wear-prototype-build-pr12531-9673681.apk

@hichamboushaba hichamboushaba added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Sep 5, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 5, 2024

📲 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
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit9673681
Direct Downloadwoocommerce-prototype-build-pr12531-9673681.apk

@codecov-commenter
Copy link

codecov-commenter commented Sep 5, 2024

Codecov Report

Attention: Patch coverage is 82.75862% with 5 lines in your changes missing coverage. Please review.

Project coverage is 40.62%. Comparing base (0ca000b) to head (9673681).
Report is 10 commits behind head on trunk.

Files with missing lines Patch % Lines
...customfields/editor/CustomFieldsEditorViewModel.kt 83.33% 1 Missing and 3 partials ⚠️
.../android/ui/customfields/CustomFieldsRepository.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #12531      +/-   ##
============================================
+ Coverage     40.61%   40.62%   +0.01%     
- Complexity     5662     5665       +3     
============================================
  Files          1228     1228              
  Lines         68879    68901      +22     
  Branches       9541     9543       +2     
============================================
+ Hits          27972    27991      +19     
- Misses        38336    38338       +2     
- Partials       2571     2572       +1     

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

@hichamboushaba hichamboushaba marked this pull request as ready for review September 5, 2024 15:33
Base automatically changed from issue/12459-custom-fields-save-changes to trunk September 10, 2024 16:33
@irfano irfano self-assigned this Sep 10, 2024
Copy link
Contributor

@irfano irfano left a comment

Choose a reason for hiding this comment

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

Good job! I didn't encounter any issues. 👍🏻 LGTM!

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/customfields/editor/CustomFieldsEditorScreen.kt
@hichamboushaba hichamboushaba removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Sep 11, 2024
@hichamboushaba hichamboushaba added this to the 20.4 milestone Sep 11, 2024
@hichamboushaba hichamboushaba merged commit e88cda4 into trunk Sep 11, 2024
16 checks passed
@hichamboushaba hichamboushaba deleted the issue/12525-custom-field-creation branch September 11, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: order details Related to order details. feature: product details Related to adding or editing products, includes product settings. type: enhancement A request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Custom Fields] Disallow entering keys that start with "_ [Custom Fields] Allow adding new fields
5 participants