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

Comment Likes: do not load on AMP views #14840

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

jeherve
Copy link
Member

@jeherve jeherve commented Feb 28, 2020

This PR syncs:

  • r203534-wpcom
  • r203555-wpcom

Related: #9555

Changes proposed in this Pull Request:

This patch disables enqueuing of assets for some non-functional features
when in AMP mode.

Affected features:

  • Comment Likes (non-functional in AMP)

Testing instructions:

  • Install the AMP plugin.
  • Enable comment likes on your site.
  • Ensure that no errors happen when loading a post in an AMP view.

Proposed changelog entry for your changes:

  • Comment Likes: do not load on AMP views

Dan Walmsley and others added 2 commits February 28, 2020 05:35
Summary:
This patch disables enqueuing of assets for some non-functional features
when in AMP mode.

Noticons is a very large CSS asset, and so it prevents a lot of other CSS from
being enqueued. A review of the places we use it showed that it was not actually
being used by any functionality that works in AMP mode.

Affected features:
- Comment Likes (non-functional in AMP)
- Geo Location (not used on most pages - might be useful to port `wpcom_vip_load_geolocation_styles_only_when_needed()` to all sites)
- Notifications UI (non-functional in AMP)
- admin-bar - (non-functional in AMP)

Test Plan:
Load a page in Transitional mode

Ensure that noticons-css is not enqueued, and that little or no CSS is blocked by AMP due to being over the 50kb max

[x] - ensure that features whose CSS is not being enqueued are not actually used

Reviewers: josephscott, #devops_team, davidbinovec, goldsounds

Subscribers: davidbinovec

Tags: #touches_jetpack_files

Differential Revision: D38340-code

This commit syncs r203534-wpcom.
Summary:
The file is synced with Jetpack, and D38340 cannot be merged into Jetpack as is as it introduces changes that will not pass our pre-commit hook.
This diff fixes all PHPCS warnings.
Test Plan: * Not much to test here, this only impacts documentation / comments.
Reviewers: goldsounds
Tags: #touches_jetpack_files

Differential Revision: D39590

This commit syncs r r203555-wpcom.
@jeherve jeherve added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Type] Dotcom Merge [Status] Tested on WP.com [Feature] Comment Likes AMP labels Feb 28, 2020
@jeherve jeherve added this to the 8.4 milestone Feb 28, 2020
@jeherve jeherve requested review from gravityrail and a team February 28, 2020 05:52
@jetpackbot
Copy link

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: March 3, 2020.
Scheduled code freeze: February 25, 2020

Generated by 🚫 dangerJS against cc06218

@kraftbj kraftbj added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Mar 2, 2020
@jeherve jeherve merged commit 025161a into master Mar 4, 2020
@jeherve jeherve deleted the fusion-sync/jeherve/r203534-wpcom-1582868113 branch March 4, 2020 09:36
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Mar 4, 2020
jeherve added a commit that referenced this pull request Mar 20, 2020
jeherve added a commit that referenced this pull request Mar 31, 2020
* Initial changelog entry

* Changelog: add #14904

* Changelog: add #14910

* Changelog: add #14913

* Changelog: add #14916

* Changelog: add #14922

* Changelog: add #14924

* Changelog: add #14925

* Changelog: add #14928

* Changelog: add #14840

* Changelog: add #14841

* Changelog: add #14842

* Changelog: add #14826

* Changelog: add #14835

* Changelog: add #14859

* Changelog: add #14884

* Changelog: add #14888

* Changelog: add #14817

* Changelog: add #14814

* Changelog: add #14819

* Changelog;: add #14797

* Changelog: add #14798

* Changelog: add #14802

* Changelog: add #13676

* Changelog: add #13744

* Changelog: add #13777

* Changelog: add #14446

* Changelog: add #14739

* Changelog: add #14770

* Changelog: add #14784

* Changelog: add #14897

* Changelog: add #14898

* Changelog: add #14968

* Changelog: add #14985

* Changelog: add #15044

* Changelog: add #15052

* Update to remove Podcast since it remains in Beta

* Changelog: add #14803

* Changelog: add #15028

* Changelog: add #15065

* Changelog:add #14886

* Changelog: add #15118

* Changelog: add #14990

* Changelog: add #14528

* Changelog: add #15120

* Changelog: add #15126

* Changelog: add #15049

* Chanegelog: add #14852

* Changelog: add #15090

* Changelog: add #15138

* Changelog: add #15124

* Changelog:add #15055

* Changelog: add #15017

* Changelog: add #15109

* Changelog: add #15145

* Changelog:add #15096

* Changelog:add #15153

* Changelog: add #15133

* Changelog: add #14960

* Changelog: add #15127

* Changelog: add #15056

* Copy current changelog to changelog archive.

* Clarify changelog description
@@ -49,6 +52,28 @@ public static function init() {

// Sync the amp-options.
add_filter( 'jetpack_options_whitelist', array( 'Jetpack_AMP_Support', 'filter_jetpack_options_whitelist' ) );

// Show admin bar.
add_filter( 'show_admin_bar', array( 'Jetpack_AMP_Support', 'show_admin_bar' ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not think this is right. It is causing the admin bar to be hidden on all AMP pages, even when it should be displayed.

In AMP plugin 1.3 we introduced AMP dev mode support to exclude the admin bar from being subject to AMP validation constraints, allowing administrative scripts and styles to work as expected even on AMP pages.

More info: https://weston.ruter.net/2019/09/24/integrating-with-amp-dev-mode-in-wordpress/

Copy link
Contributor

Choose a reason for hiding this comment

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

@jeherve if the issue is the scripts and styles that the Jetpack Likes module includes, a better way to resolve this I think is to explicitly mark them for AMP dev mode by adding admin-bar as a dependency for the scripts and styles.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for jumping in. We'll need to revisit this. I've logged your remarks in #15353.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants