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
Add red bubble with update count on in-app My Subscriptions tab #46088
Conversation
Hi @laurendavissmith, @anaspk, @denho, 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: |
plugins/woocommerce-admin/client/marketplace/components/tabs/tabs.tsx
Outdated
Show resolved
Hide resolved
…erce/woocommerce into update/red-bubble-on-my-subs-tab
@@ -60,6 +62,7 @@ function ( $product ) { | |||
'wooUpdateManagerActive' => WC_Woo_Update_Manager_Plugin::is_plugin_active(), | |||
'wooUpdateManagerInstallUrl' => WC_Woo_Update_Manager_Plugin::generate_install_url(), | |||
'wooUpdateManagerPluginSlug' => WC_Woo_Update_Manager_Plugin::WOO_UPDATE_MANAGER_SLUG, | |||
'wooUpdateCount' => WC_Woo_Update_Manager_Plugin::increment_update_count_for_woo_update_manager( WC_Helper_Updater::get_updates_count() ?? 0 ), |
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.
The logic of getting the count here duplicates the logic in get_updates_count_html
. Would it be possible to standardize and have just one function that returns the final count?
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.
Fixed here: f09891b
plugins/woocommerce/includes/admin/helper/class-wc-woo-update-manager-plugin.php
Outdated
Show resolved
Hide resolved
plugins/woocommerce-admin/client/marketplace/components/tabs/tabs.tsx
Outdated
Show resolved
Hide resolved
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.
Thank you @thilinah , LGTM and works as described. Just posted a minor comment.
plugins/woocommerce-admin/client/marketplace/components/tabs/tabs.tsx
Outdated
Show resolved
Hide resolved
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.
LGTM!
$count_html = sprintf( '<span class="update-plugins count-%d"><span class="update-count">%d</span></span>', $count, number_format_i18n( $count ) ); | ||
|
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.
* Extract update count function. * Pass wooUpdateCount to be used by admin components. * Show update count bubble on in-app my subscriptions tab. * Add changefile(s) from automation for the following project(s): woocommerce * Refactor how update count HTML is generated and move logic into appropriate classes. * Show red badge when the site is disconnected, regardless of the installation status of WUM. * Always display as 1 update is available when site is disconnected. * Skip using dangerouslySetInnerHTML. * Remove unused dependency. * Move updateCount to a tab property. * Prevent calling get_update_count if the site is not connected. * Raw url encode the product key before signing the URL --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Muhammad Anas <muhammad.anas@automattic.com>
* Add red bubble with update count on in-app My Subscriptions tab (#46088) * Extract update count function. * Pass wooUpdateCount to be used by admin components. * Show update count bubble on in-app my subscriptions tab. * Add changefile(s) from automation for the following project(s): woocommerce * Refactor how update count HTML is generated and move logic into appropriate classes. * Show red badge when the site is disconnected, regardless of the installation status of WUM. * Always display as 1 update is available when site is disconnected. * Skip using dangerouslySetInnerHTML. * Remove unused dependency. * Move updateCount to a tab property. * Prevent calling get_update_count if the site is not connected. * Raw url encode the product key before signing the URL --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Muhammad Anas <muhammad.anas@automattic.com> * Prep for cherry pick 46088 --------- Co-authored-by: Thilina Pituwala <thilina.hasantha@gmail.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Muhammad Anas <muhammad.anas@automattic.com> Co-authored-by: WooCommerce Bot <no-reply@woo.com>
* Extract update count function. * Pass wooUpdateCount to be used by admin components. * Show update count bubble on in-app my subscriptions tab. * Add changefile(s) from automation for the following project(s): woocommerce * Refactor how update count HTML is generated and move logic into appropriate classes. * Show red badge when the site is disconnected, regardless of the installation status of WUM. * Always display as 1 update is available when site is disconnected. * Skip using dangerouslySetInnerHTML. * Remove unused dependency. * Move updateCount to a tab property. * Prevent calling get_update_count if the site is not connected. * Raw url encode the product key before signing the URL --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Muhammad Anas <muhammad.anas@automattic.com>
* Extract update count function. * Pass wooUpdateCount to be used by admin components. * Show update count bubble on in-app my subscriptions tab. * Add changefile(s) from automation for the following project(s): woocommerce * Refactor how update count HTML is generated and move logic into appropriate classes. * Show red badge when the site is disconnected, regardless of the installation status of WUM. * Always display as 1 update is available when site is disconnected. * Skip using dangerouslySetInnerHTML. * Remove unused dependency. * Move updateCount to a tab property. * Prevent calling get_update_count if the site is not connected. * Raw url encode the product key before signing the URL --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Muhammad Anas <muhammad.anas@automattic.com>
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes # .
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
pnpm -- wp-env start
pnpm --filter='@woocommerce/plugin-woocommerce' build
1
number of updates Available for Woo.com extensions
+ 1.2
.1
as Woo.com Update Manager isn't installed.Install WUM by downloading it via : https://woo.com/product-download/woo-update-manager
If WUM is installed but not activated, still the red bubble should be displayed.
Changelog entry
Significance
Type
Message
Displays a red badge on in-app My Subscriptions tab if Woo.com Update Manager is not installed or activated
Comment