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

Eliminate varying URL Metrics by logged-in state and discontinue disabling optimization by default for admins #1788

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Jan 10, 2025

This is the first PR to address #1787.

  1. Eliminate this logic from od_get_normalized_query_vars().
  2. Eliminate the restriction that Optimization Detective be disabled for admins.

A subsequent PR will be opened to address the XPath change, since that will be a massive PR touching many tests.

Fixes #1425

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Optimization Detective Issues for the Optimization Detective plugin labels Jan 10, 2025
Copy link

github-actions bot commented Jan 10, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: felixarntz <[email protected]>
Co-authored-by: swissspidy <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter westonruter changed the title Update/od auth conditions Eliminate varying URL Metrics by logged-in state and discontinue disabling optimization by default for admins Jan 10, 2025
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.43%. Comparing base (b6e5c5a) to head (4c1aa71).
Report is 3 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #1788      +/-   ##
==========================================
- Coverage   57.48%   57.43%   -0.06%     
==========================================
  Files          84       84              
  Lines        6516     6508       -8     
==========================================
- Hits         3746     3738       -8     
  Misses       2770     2770              
Flag Coverage Δ
multisite 57.43% <ø> (-0.06%) ⬇️
single 34.55% <ø> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@westonruter Mostly looks good, just one concern.

// wp_customize_support_script(), which will interfere with the XPath indices. Note that
// od_get_normalized_query_vars() is varied by is_user_logged_in(), so membership sites and e-commerce sites
// will still be able to be optimized for their normal visitors.
( current_user_can( 'customize' ) && ! wp_is_development_mode( 'plugin' ) ) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the development mode condition here? That seems unrelated to what this PR is doing, so shouldn't it be kept?

Copy link
Member Author

@westonruter westonruter Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The development mode condition was added to force optimization to be performed even when the user is an administrator. However, now optimization applies by default for everyone including administrators, so this is obsolete.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context, see #1423 fixed via #1700.

@westonruter westonruter merged commit 3dc1090 into trunk Jan 13, 2025
29 checks passed
@westonruter westonruter deleted the update/od-auth-conditions branch January 13, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimization Detective should be enabled by default for admins
3 participants