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

Fix unnecessary capability calls #631

Merged
merged 5 commits into from
Oct 28, 2024
Merged

Conversation

arunshenoy99
Copy link
Member

@arunshenoy99 arunshenoy99 commented Oct 28, 2024

Proposed changes

  1. This PR introduces a new $populate_capabilities flag when retrieving brand data.
  2. Moves REST API initialization to admin (RestApiFilter was also retrieving capabilities for a commerce check, which was unnecessary).

Goes with: newfold-labs/wp-module-onboarding-data#121

This was the shortest way I could find to update the functions without breaking all the other code that uses this.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Video

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web-browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@wpscholar
Copy link
Member

Update: We've removed the flags from the functions in favor of a small change in the Config::get_site_capability() function.

@wpscholar wpscholar merged commit 92f4bbe into trunk Oct 28, 2024
3 of 5 checks passed
@wpscholar wpscholar deleted the fix/leaky-capability-calls branch October 28, 2024 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants