Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.42k stars 1.99k forks source link

Marketplace search: return `active_installs` field from the API #68078

Closed gcsecsey closed 2 years ago

gcsecsey commented 2 years ago

This is a follow-up issue to #63167.

Currently, the plugin.active_installs field is not being returned by the API: https://public-api.wordpress.com/rest/v1.3/marketplace/search?group_id=wporg&fields[]=plugin.title&fields[]=plugin.active_installs&category=popular

Looking at the code, the field is added to the returnable_fields array, despite this the field is not returned: 2da84-pb

epeicher commented 2 years ago

After a quick initial investigation, I have found that the plugin.active_installs is returned in the _source field but not in the fields field, code here 2da88-pb

Then, when building the results the field _source.plugin.active_installs seems to be skipped by the following logic 2da86-pb/#plain

gcsecsey commented 2 years ago

A fix for this issue has been deployed with D87985-code

epeicher commented 2 years ago

Hi @gcsecsey, I cannot see the fix in the diff, I added it in a comment as a suggestion but I did not commit any code. Could it be that it has been missed? 🤔

gcsecsey commented 2 years ago

Oof, I'm sorry @epeicher, for some reason I've believed your comment to be an addition to the diff here 🤦

CleanShot 2022-09-27 at 14 47 49@2x

I'm going to raise a small diff with this change soon!

gcsecsey commented 2 years ago

Raised diff D88613-code

epeicher commented 2 years ago

I have reviewed the diff and LGTM. I have added the task to the sprint and changed the status to Ready to Merge 🚢

gcsecsey commented 2 years ago

Changes have been deployed in r253339-wpcom