Ensure all inline @todos in code are covered by issues and obsolete @todos removed. (https://github.com/woocommerce/woocommerce-blocks/pull/2557)

* Remove todos for colors (see woocommerce/woocommerce-blocks#1331)

* remove todo for payment method express payments placeholder

No placeholder is needed because we don’t want to show this at all if there are no payment methods setup (or initialized based on `canMakePayment`). The payment methods step will have instructions in the editor for users to setup their payment methods.

So this todo was invalid.

* Remove todo comment for useStoreOrder (see woocommerce/woocommerce-blocks#2555)

* remove obsolete todos for usePaymentMethodInterface

* changed todo into a Note for the useQueryState tests

With focused work happening on tests, this is better as a note that can be picked up when this file is touched again.

* remove obsolete todo from payment method registration validation

* remove todo covered by created issue (see woocommerce/woocommerce-blocks#2166)

* remove obsolete todo for stripe utils

* Convert todo to a Note for Checkout Block php registration

For now, I think having the comment block noting what is happening here is sufficient. Whether or not we extend the blocks to cover the other endpoints is something that will surface in future planning and putting in an issue right now coudl be premature (and likely just land the issue in the icebox)

* Remove todo related to ReserveStock covered by woocommerce/woocommerce-blocks#2556

* Remove todo in AbstractRoute covered by issue in WooCommerce project

see https://github.com/woocommerce/woocommerce/pull/26219 for the issue.

* Convert todo to note for wp_version check in Library class
This commit is contained in:
Darren Ethier 2020-05-26 13:31:33 -04:00 committed by GitHub
parent d81444f208
commit a5b6061dcc
13 changed files with 4 additions and 24 deletions

View File

@ -44,12 +44,11 @@ $error-red: #d94f4f;
$box-shadow-blue: #5b9dd9; $box-shadow-blue: #5b9dd9;
$core-orange: #ca4a1f; $core-orange: #ca4a1f;
// @todo: replace those colors with the correct values once we settle on a design system palette.
$gray-10: #c3c4c7; $gray-10: #c3c4c7;
$gray-20: #a7aaad; $gray-20: #a7aaad;
$gray-50: #646970; $gray-50: #646970;
$gray-60: #50575e; $gray-60: #50575e;
$gray-80: #2c3338; $gray-80: #2c3338;
// @todo: align those colors with what we have
$input-border-gray: #8d96a0; $input-border-gray: #8d96a0;
$input-text-active: #2b2d2f; $input-text-active: #2b2d2f;

View File

@ -34,8 +34,6 @@ const ExpressCheckoutContainer = ( { children } ) => {
const ExpressCheckoutFormControl = () => { const ExpressCheckoutFormControl = () => {
const { paymentMethods, isInitialized } = useExpressPaymentMethods(); const { paymentMethods, isInitialized } = useExpressPaymentMethods();
// determine whether we even show this
// @todo if in the editor we probably would want to show a placeholder maybe?
if ( if (
! isInitialized || ! isInitialized ||
( isInitialized && Object.keys( paymentMethods ).length === 0 ) ( isInitialized && Object.keys( paymentMethods ).length === 0 )

View File

@ -1,6 +1,3 @@
// @todo finish out this hook which will return a store draft order id and
// order loading (likely from payment data context).
export const useStoreOrder = () => { export const useStoreOrder = () => {
const orderId = 0; const orderId = 0;
return { return {

View File

@ -79,9 +79,6 @@ export const prepareTotalItems = ( totals, needsShipping ) => {
return newTotals; return newTotals;
}; };
// @todo This will expose the consistent properties used as the payment method
// interface pulled from the various contexts exposing data for the interface.
// @todo need to also include notices interfaces here (maybe?).
/** /**
* @return {RegisteredPaymentMethodProps} Interface to use as payment method props. * @return {RegisteredPaymentMethodProps} Interface to use as payment method props.
*/ */

View File

@ -204,7 +204,7 @@ describe( 'Testing Query State Hooks', () => {
} }
); );
} ); } );
// @todo, these tests only add partial coverage because the state is not // Note: these tests only add partial coverage because the state is not
// actually updated by the action dispatch via our mocks. // actually updated by the action dispatch via our mocks.
describe( 'useSynchronizedQueryState', () => { describe( 'useSynchronizedQueryState', () => {
const TestComponent = getTestComponent( useSynchronizedQueryState, [ const TestComponent = getTestComponent( useSynchronizedQueryState, [

View File

@ -7,7 +7,6 @@ export const assertValidPaymentMethodComponent = (
component, component,
componentName componentName
) => { ) => {
// @todo detect if functional component (not render prop)
if ( typeof component !== 'function' ) { if ( typeof component !== 'function' ) {
throw new TypeError( throw new TypeError(
`The ${ componentName } property for the payment method must be a functional component` `The ${ componentName } property for the payment method must be a functional component`

View File

@ -38,8 +38,6 @@ const normalizeLineItems = ( cartTotalItems, pending = false ) => {
* @return {StripeShippingOption[]} An array of Stripe shipping option items. * @return {StripeShippingOption[]} An array of Stripe shipping option items.
*/ */
const normalizeShippingOptions = ( shippingOptions ) => { const normalizeShippingOptions = ( shippingOptions ) => {
// @todo, note this currently does not handle multiple packages and this
// will need to be dealt with in a followup.
const rates = shippingOptions[ 0 ].shipping_rates; const rates = shippingOptions[ 0 ].shipping_rates;
return rates.map( ( rate ) => { return rates.map( ( rate ) => {
return { return {

View File

@ -17,11 +17,6 @@ import { __ } from '@wordpress/i18n';
* @typedef {import('@woocommerce/type-defs/registered-payment-method-props').PreparedCartTotalItem} CartTotalItem * @typedef {import('@woocommerce/type-defs/registered-payment-method-props').PreparedCartTotalItem} CartTotalItem
*/ */
// @todo this can't be in the file because the block might not show up unless it's
// rendered! (which also means it won't get passed from the server until it is rendered).
// so we need to work out a loading process for when the cart or checkout hasn't been added to the
// content yet - definitely don't want to load stripe without the block in the page. So that means
// checkout will need to have some sort of editor preview for stripe.
/** /**
* Stripe data comes form the server passed on a global object. * Stripe data comes form the server passed on a global object.
* *

View File

@ -50,7 +50,7 @@ class Checkout extends AbstractBlock {
*/ */
public function render( $attributes = array(), $content = '' ) { public function render( $attributes = array(), $content = '' ) {
if ( $this->is_checkout_endpoint() ) { if ( $this->is_checkout_endpoint() ) {
// @todo Currently the block only takes care of the main checkout form -- if an endpoint is set, refer to the // Note: Currently the block only takes care of the main checkout form -- if an endpoint is set, refer to the
// legacy shortcode instead and do not render block. // legacy shortcode instead and do not render block.
return '[woocommerce_checkout]'; return '[woocommerce_checkout]';
} }

View File

@ -65,7 +65,7 @@ class Library {
'ProductSearch', 'ProductSearch',
'ProductTag', 'ProductTag',
]; ];
// @todo after refactoring dynamic block registration, this will be moved // Note: as a part of refactoring dynamic block registration, this will be moved
// to block level config. // to block level config.
if ( version_compare( $wp_version, '5.2', '>' ) ) { if ( version_compare( $wp_version, '5.2', '>' ) ) {
$blocks[] = 'AllProducts'; $blocks[] = 'AllProducts';

View File

@ -274,7 +274,6 @@ abstract class AbstractRoute implements RouteInterface {
*/ */
protected function maybe_load_cart() { protected function maybe_load_cart() {
if ( ! did_action( 'woocommerce_load_cart_from_session' ) && function_exists( 'wc_load_cart' ) ) { if ( ! did_action( 'woocommerce_load_cart_from_session' ) && function_exists( 'wc_load_cart' ) ) {
// @todo Load Dependencies for wc_load_cart(). See https://github.com/woocommerce/woocommerce/pull/26219
include_once WC_ABSPATH . 'includes/wc-cart-functions.php'; include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
include_once WC_ABSPATH . 'includes/wc-notice-functions.php'; include_once WC_ABSPATH . 'includes/wc-notice-functions.php';
wc_load_cart(); wc_load_cart();

View File

@ -363,7 +363,6 @@ class CartItemSchema extends ProductSchema {
$draft_order = wc()->session->get( 'store_api_draft_order', 0 ); $draft_order = wc()->session->get( 'store_api_draft_order', 0 );
// @todo Remove once min support for WC reaches 4.1.0.
if ( \class_exists( '\Automattic\WooCommerce\Checkout\Helpers\ReserveStock' ) ) { if ( \class_exists( '\Automattic\WooCommerce\Checkout\Helpers\ReserveStock' ) ) {
$reserve_stock = new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock(); $reserve_stock = new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock();
} else { } else {

View File

@ -626,7 +626,6 @@ class CartController {
* @return int * @return int
*/ */
protected function get_remaining_stock_for_product( $product ) { protected function get_remaining_stock_for_product( $product ) {
// @todo Remove once min support for WC reaches 4.1.0.
if ( \class_exists( '\Automattic\WooCommerce\Checkout\Helpers\ReserveStock' ) ) { if ( \class_exists( '\Automattic\WooCommerce\Checkout\Helpers\ReserveStock' ) ) {
$reserve_stock_controller = new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock(); $reserve_stock_controller = new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock();
} else { } else {