#55316 closed enhancement (fixed)
Counter for total plugins is not updated after a plugin is deleted
Reported by: | mitogh | Owned by: | peterwilsoncc |
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Plugins | Keywords: | needs-testing has-testing-info has-patch |
Focuses: | ui, administration | Cc: |
Description
Context
When a plugin is deleted, the total count is updated correctly on the left count, however, the total count is not updated correctly on the right count (as you can see on the screenshot) and by following the steps to replicate this problem.
Steps to replicate.
- Install any plugin
- Activate the plugin
- Go to the plugin lists
- Deactivate the plugin
- Observe the total count of active plugins
- Click on Delete and accept the prompt to remove it.
- Observe how the total count decreased by 1 but the total items count on the right was not modified after the plugin was deleted.
Attachments (9)
Change History (26)
#1
@
3 years ago
- Milestone changed from Awaiting Review to 6.0
- Type changed from defect (bug) to enhancement
- Version 5.9.1 deleted
@
3 years ago
Update item count upon plugin deletion. Do not commit this patch - it needs review for i18n.
#2
@
3 years ago
- Keywords needs-testing has-testing-info needs-refresh added
Patch 55316.diff should update the item count when a plugin is deleted.
However, this does not account for i18n/rtl and will need some input from a developer familiar with this.
Steps to test:
- Navigate to
Plugins > Installed Plugins
. - Observe the total count of "All" plugins.
- Click on Delete and accept the prompt to remove it.
- Observe how the total count decreased by 1 but the total items count on the right was not modified after the plugin was deleted.
- Apply 55316.diff.
- Run
npm run build:dev
. - Navigation to
Plugins > Installed Plugins
. - Do a hard refresh to ensure that scripts have been refreshed.
- Repeat steps 2-4. This time, the item count should decrease by 1 as expected.
#4
@
3 years ago
Thanks for the tests @azouamauriac!
The patch is changing the value to plugins.all.length
.
That's why it looked like the patch worked in the Auto-updates Disabled test, when in fact it was a coincedence that All and Auto-updates Disabled were the same number. I've have another look at the patch.
@
3 years ago
Patch updated to use the count of the current view. Still needs a refresh for i18n if anyone is familiar with this.
#6
@
3 years ago
For proper i18n you'll need to use wp.i18n._n()
together with wp.i18n.sprintf
. Make sure wp-i18n
is a dependency of the updates.js
script if not already the case.
@
3 years ago
after patch 55316.2.diff; same result for following tab: 'Inactive', 'Auto-updates Disabled'. The patch works
#8
in reply to:
↑ 5
@
3 years ago
Replying to costdev:
Patch updated if you have time to run more tests @azouamauriac
Done! Patch works on my side.
#9
@
3 years ago
Thanks @azouamauriac!
I'll work on i18n and try to get this patch ready for further testing.
#11
@
3 years ago
- Keywords needs-refresh added
Perhaps use _nx()
in combination with number_format_i18n()
instead of just _n()
? That way a comment can be added that the items word in this case means plugins, and the counter is displayed in the locales number format.
https://developer.wordpress.org/reference/functions/_nx/
https://developer.wordpress.org/reference/functions/number_format_i18n/
#12
@
3 years ago
Sorry, the number function can not be used with JavaScript so just ignore that part of the ”suggestion ”.
This ticket was mentioned in Slack in #core by costdev. View the logs.
3 years ago
This ticket was mentioned in PR #2540 on WordPress/wordpress-develop by kebbet.
3 years ago
#14
- Keywords has-patch added; needs-refresh removed
#15
@
3 years ago
Linked PR uses _nx()
in the JavaScript-file. Rest of it is ported from 55316.3.diff
by @costdev.
#16
@
3 years ago
- Owner set to peterwilsoncc
- Resolution set to fixed
- Status changed from new to closed
In 53124:
Reproc Report
Env
Steps to test
Plugins > Installed Plugins
.Results
Milestoning for 6.0 and removing the version as this will have existed for quite some time.